My CSS styles are not applying because of a MIME type issue. I am using Express to serve my HTML page, but for some reason, the CSS is not being displayed correctly. I have tried various solutions, but it seems like I am missing something simple. Can someone please take a look at my code and help me figure out where I am going wrong?
server.js
app.use(express.static(path.join(__dirname + '/public')));
app.get('/', (req, res)=> {
res.sendFile(path.join(__dirname, 'index.html'))
})
Although the index.html file loads properly, the CSS styling is not applied.
This is how I linked my CSS in HTML:
<link rel = "stylesheet" type="text/css" href="styles.css">
Here is my file structure:
>backend
index.html
server.js
>public
styles.css