Skip to content
Advertisement

The HTML file dont hit the CSS file

I am beginner in express, js and node.js

I have followed lot of tutorials about express, and i dont understand why the index.html file dont call the corresponding CSS file:

my server.js file:

JavaScript

my index.html file:

JavaScript

my CSS file:

JavaScript

and the different folders of the project:

enter image description here

when i type localhost:8081/0, the result is not the right result, the CSS is not active.

What am i doing wrong? thanks for help

Advertisement

Answer

express.static bind public folder to site root (/) so after that you need to include static files without public in path:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement