ErcDz
1
After reading the docs and the FCC explanation, I’m still stuck on the concept of middleware. For example
// accesses __dirname + /public
app.use(express.static(__dirname + "/public"));
// accesses /public + __dirname + /public (?)
app.use("/public", express.static(__dirname + "/public"));
If my comments are correct, why can’t I just write
app.use(express.static("/public" + __dirname + "/public"));
Maybe this will help answer it.
ErcDz
4
Thank you for your response.
Just to check if I’m understanding correctly, this:
app.use("/public", express.static(__dirname + "/public"));
Could look like this:
https://yoursite.com(“/public”)(__dirname + “/public”)
For example:
app.use("/styles", express.static(__dirname + "/styles"));
// let's say the only file in styles is a css file called cool.css
is
https://yoursite.com/styles/cool.css
Would this be correct?
Yes, that would be correct.
system
Closed
6
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.