I think the wording of this challenge is confusing (or maybe the setup is just wrong). It tells you to use the path __dirname + '/public', but the CSS file linked in the template HTML already has the /public part in its href: /public/style.css. Which I think is wrong, because the href is essentially /public/public/style.css now.
Solution is to only use __dirname in the .static method.
I’m confused, there’s a route / which serves a file from the views folder (because that’s where the index.html is located), and any static asset files are served from the public folder:
Basically, middleware are functions that intercept route handlers, adding some kind of information. 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 requests.
Mount the express.static() middleware to the path /public with app.use() . The absolute path to the assets folder is __dirname + /public .
[quote=“jsdisco, post:3, topic:448158”]
href: /public/style.css
[/quo The only way to make that pass the challenge, is if you change in the html the reference to the css file, just by deleating the /public part.