I am trying to implement my css in my html with nodeJS, Express and socket.io but i got the error:
'Refused to apply style from 'http://localhost:8000/index.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.'
Note: I only got the error displaying the css files when i run in my localhost:8000 (Node.js) but not in my normal index.html file.
here is my config in index.js
var app = express()
.use(SocketIOFileUpload.router)
.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
})
here is my files structure
- style
- style.css
- images
- lib
- node_modules
index.html
appConfig.js
index.js
So far, what i did is:
- i change my css script from
<link rel="stylesheet" type="text/css" href="style/style.css"/>
into type="text/html"
: it did remove the error but my css still have not applied in the html
- checked the spelling of my css file name: no issue on the name or the css path
i have search all over the internet, but nothing helps. It might be i configured it wrongly since i am not really familiar with the config, but i don't have any ideas. Any helps or hints area really helpful. Thanks!