简体   繁体   中英

express.static middleware not looking in the specified directory (for serving static files)

I have a fairly simple setup

app.configure(function() {
    app.use('/public', express.static(__dirname + '/public'));
    app.use(app.router);
});

app.get('/', function(req, res) {
...

I request /somefile and expect express to look for it in /public/somefile .

But it doesn't look there.

But when I look for public/somefile directly, it does find it.

Is something wrong with my code?

It was just a cache issue. Force-reload fixed it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM