Working on a Nodejs - Express - Vanillajs project, I encountered an issue when testing my routes. The index page failed to load CSS, displaying the following error message:
Refused to apply style from 'http://localhost:3000/public/css/bootstrap.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
This problem persisted across multiple browsers including Chrome, Chromium, and Firefox. My project has the following folder structure:
server.js
public
|-css
|style.css
The project follows MVC architecture with the view engine set to index.html. The CSS is linked as follows:
<link rel="stylesheet" type="text/css" href="../public/css/style.css" />