Tell us what’s happening:
Hi everybody, I’m stuck and I can’t understand why.
I am trying to use the “express.static()” method as the middleware to serve static assets from the “public” folder, as explained in the help section. But I get the " Your app should serve asset files from the /public directory" and can’t pass the challenge.
Could someone please help.
Your code so far
app.use("/assets", express.static(__dirname + “/public”));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.
For others having trouble with errors: you may need to just click the Stop and Start 4-5 times and keep resubmitting your code. In other words, you can have the right answer and it still throws errors insisting the path is “/public” even though you have that. Eventually it catches on and passes.