Css Not Loading With Req.params Or Maybe Something Else
I'm very new to node, express etc. I've made a blog-app and i'm facing a problem. I'm using mongoose, node, express and ejs. When i call router.get('/posts', function(req, res){
Solution 1:
<link rel="stylesheet" href="style.css">
tries to load style.css
from the same path where the HTML page is. So, for /posts
, it will try loading /style.css
and for /posts/1
, it will try to load /posts/style.css
. But the latter matches your /posts/:posts_id
endpoint, so that gets called instead with posts_id == 'style.css'
, which is nonsensical.
The solution is quite simply to make the link absolute:
<link rel="stylesheet" href="/style.css">
Post a Comment for "Css Not Loading With Req.params Or Maybe Something Else"