I have ran into an issue when using ejs to link external stylesheets and script tags. Here is my link for my stylesheet.
<link rel="stylesheet" href="styles/index.css">
When I highlight the link to the sheet and follow it (in VScode) I am brought to the correct file. I know it is going to the correct location for sure.
However, when I run this on my localhost:5000 I get an error. Here is what the error reads.
Refused to apply style from 'http://localhost:5000/styles/index.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
I notice this is pointing to my localhost:5000/styles/index.css, but I do not want it to point to my local host, I want it to point to the directories I have set up in my file structure.
Does anyone know how to resolve this?
Thank you so much for your time.
if u are trying to use ejs in a nodejs project with express ,u should first define a folder that contain all the static files like css and images then give permission to the browser to get this file .check this: https://expressjs.com/en/starter/static-files.html