Mark Spencer Mark Spencer - 1 year ago 113
Node.js Question

Static files are not served

I want to serve css file(s) from the 'css' folder...

I have this line of code so far :

app.use("/static", express.static(path.resolve(__dirname + "/../views/public/css")));

I put
to go a path backwards.

and this is my folder hierarchy:

Folder hierarchy

I go to
- the server can not get this

Answer Source

As described in my comment, node looks for static directories based off the main JS file. Try it without the /../ and it should work.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download