I have set up a nodejs server with the following code. Currently, I haven't included any references to HTML or CSS in the code because I am unsure how to do that.
const http = require('http');
// Create an instance of the http server to handle HTTP requests
let app = http.createServer((req, res) => {
// Set a response type of plain text for the response
res.writeHead(200, {'Content-Type': 'text/plain'});
// Send back a response and end the connection
res.end('Hello World!\n');
});
// Start the server on port 3000
app.listen(3000, '127.0.0.1');
console.log('Node server running on port 3000');
In a directory similar to this
Despite hours of online research and going through previous stackoverflow posts, I still haven't been able to resolve my issue. Although I did manage to load the HTML file at one point, I couldn't get the CSS file to load properly.