At Node Express Execution Css And Js Files Are Not Loading
I am having index.html, css and js files in letschat folder. After running the node express server it is not loading the css and js files. I am giving the server.js code. please le
Solution 1:
When you do this:
app.use("/letschat", express.static(__dirname + '/letschat'));
you're telling Express that a request for /letschat/styles.css
should be looked for in __dirname + '/letschat/styles.css'
.
So, for that to work properly, the URL in your HTML page would have to be /letschat/styles.css
.
If you want the URL in your web page to just be /styles.css
, then change your server code to:
app.use(express.static(__dirname + '/letschat'));
Post a Comment for "At Node Express Execution Css And Js Files Are Not Loading"