I'm a beginner in web development and recently completed an online course on node.js and express. However, the course didn't cover how to add HTML, CSS, and JS files when using Node.
I attempted the following:
var express = require('express');
var app = express();
var port= 3000;
app.use(express.static('public'));
app.listen(port, function(){
console.log('Express app listening on port ' + port);
})
app.get('/hello', function(request, response){
response.sendFile('index.html')
})
In this server.Js file, I specified the HTML file that should load on the page. The page loads, but without any styling and it doesn't load the images within it...
What steps need to be taken to ensure my front-end files are accessible when called?