My CSS is not applying when I host my html file using Express. Why is that happened and is there a way to add my CSS file using Express?
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.urlencoded({
extended: true,
}));
app.get('/', (req, res) => {
res.sendFile(__dirname + '/index.html');
});
app.post('/', (req, res) => {
console.log(req.body);
res.send("You just posted");
});
app.listen(4400, () => {
console.log("Server is running on port 4400");
});
I tried to add my CSS file using Express.