How do I properly load my CSS file using express.static in Node.js? I have attempted various methods to link my stylesheet to my HTML file through Express, and I'm also interested in learning how to include images, JavaScript, and other assets to create a more dynamic website. Despite trying multiple solutions, I haven't been able to find the right one.
const express = require('express');
const app = express();
app.use(express.static(__dirname));
getId = (req, res) => {
const id= req.params.id * 1;
res.sendFile(`${__dirname}/index.html`);
}
app.get('/hibiscos/:id', getId);
const port = 8000;
app.listen(port, () => {
console.log(`Server running on port ${port}...`);
//console.log(`${__dirname}`);
});