I am creating a blog application using nodejs
and express with ejs
. everything is working fine with a single URL
( means http://localhost/ or http://localhost/anything ), but when I am trying to access a page http://localhost/blog/create
in this page external stylesheet
or javascript
not working, it's loading as http://localhost/blog/css/style.css
(it should be http://localhost/css/style.css)
.
I am using middleware static to load css
and js
from public directory
app.use(express.static(__dirname + '/public'));
header and footer are loading using <%- include('./partials/header') %>
Directory Structure:
View Files : views
header & footer : views/Partials
css and js : public