Programmers learn & share
0 votes
78 views

Problem :

Encountered mime type error and looking for its solution
because its mime type ('text/html') is not executable, and strict mime type checking is enabled.
by (6.9k points)   | 78 views

1 Answer

0 votes

Solution :

Please use express.static() if you are using Node.js.

You need to simply pass the name of the directory where you are keeping your static assets to express.static middleware to start facilitate serving the files directly. 

e.g. if you are keeping your images, CSS, and JavaScript files in a directory whose name is public, then you can follow below approach :

 app.use(express.static('public'));

This approach helped me in resolving my issue.

by (36.1k points)  
2,218 questions
2,683 answers
59 comments
241 users