I've been diving into Node.js and I've hit a roadblock. I'm facing an issue with loading css and js files in my project. Despite successfully rendering Bootstrap and Fontawesome from a CDN, my custom css and js files refuse to load.
This is the file path structure:
folder
index.html
app.js
package.json
css
main.css
files
file.pdf
Here's a snippet of my app.js code:
var http = require('http');
var fs = require('fs');
//creating server
http.createServer(function (req, res) {
fs.readFile('index.html', function (err, html) {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.write(html);
res.end();
});
}).listen(8080);