I am encountering an issue with my application that serves HTML, and the code snippet looks like this:
// ...
var staticPath = config.development.staticFiles;
app.get('/category/:catName', function(req, res) {
res.sendFile(path.join(__dirname, staticPath + "shop-grid.html"));
})
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname, staticPath + "index.html"));
})
// ...
Within each HTML file, the CSS is linked as follows:
<link rel="stylesheet" href="css/style.css" type="text/css">
The index.html displays correctly, but the "shop-grid.html" does not load with CSS. It appears to be trying to load the CSS from "localhost:8080/category/css/style.css" instead of "localhost:8080/css/style.css", which works for the first HTML page.
Can someone please help me identify what mistake I made here?