Ask coding questions

← Back to all posts
Express.static still giving "Cannot GET"
MaxwellGeringer

I am trying to use Express.static() to handle loading css files, but when I use it, it still gives me "Cannot GET". I have tried app.use(Express.static('/files')) and app.use('/files', Express.static('/files')), but both give the same result.

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
MaxwellGeringer
Comments
hotnewtop
Coder100

express makes all paths absolute, and the repl is not in the absolute place. You have to use __dirname: