Answer the question
In order to leave comments, you need to log in
Why are styles and scripts not loaded with a dynamic url?
Good afternoon, if you make such a route:
app.get("/work", (req, res) => {
return res.render("work");
});
app.get("/work/:id", (req, res) => {
return res.render("work");
});
Answer the question
In order to leave comments, you need to log in
I think you are giving away static resources incorrectly. Here is the documentation
If the templates contain the correct path to static files and in express you configured the return of statics correctly, according to the documentation, then there will be no problems.
If you used this option:
app.use(express.static(path.join(__dirname, 'public')))
<link rel="stylesheet" href="/css/main.css">
<script src="/js/main.js"></script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question