I recently encountered a peculiar issue that I managed to resolve, but I'm curious as to why it occurred in the first place. My project involves node.js with express.
app.get('/eventname/:event', (req, res) => {
res.render('event.hbs', {
name: req.user.displayName
});
})
Even though there was no specific "/eventname" route defined in my server.js file, the pages loaded successfully. However, my .css files failed to load due to a "MIME type not supported" error. Interestingly, when I removed the '/eventname' part from the code:
app.get('/:event', (req, res) => {
res.render('event.hbs', {
name: req.user.displayName
});
})
Everything started working smoothly without any issues. I'm puzzled as to why this happened - could I be making a mistake in how I'm using express?