Basic Node and Express - Serve Static Assets - -6zwBNR-O64REJj2EI3pz

Tell us what’s happening:
Describe your issue in detail here.
I’m unable to serve the css files? I’m using express static but when nothing is showing up.

Your code so far

app.use(express.static(__dirname + ‘public’))

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36

Challenge: Basic Node and Express - Serve Static Assets

Link to the challenge:

It’s easier to debug if you provide your replit or glitch

Mount the express.static() middleware to the path /public

Look at the two last examples in the Express docs.

I had the same syntax but there is still no change to the site. The app.use expression should sit outside of the app.get function correct?

Nevermind, I was able to resolve it by replacing static with public

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.