Help - Serving Static Asset

Hi, I’m stuck on the serving a static asset challenge.

A middleware needs to be mounted using the method app.use(path, middlewareFunction). The first path argument is optional. If you don’t pass it, the middleware will be executed for all the requests.

Mount the express.static() middleware for all the requests with app.use(). The absolute path to the assets folder is __dirname + /public.

This is my code below.

app.use(express.static(__dirname + "/public"));

Any help is appreciated!

1 Like

Hi, are you getting any errors?

GET https://equal-tablecloth.glitch.me/style.css/ net::ERR_ABORTED 404

That’s what I get in my console when I view the app live in Glitch. Otherwise I don’t see any errors!

same here, somehow glitch is adding suffix ‘/’ when load css.
i tried the same code to load static files, it works on my local pc.