简体   繁体   中英

express.static not working with heroku

I've got this code:

app.use(express.static(__dirname + '/assets'));

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

    res.sendFile(path.join( __dirname, 'assets', 'index.html' ));
});

But am still getting these errors: 在此处输入图片说明

Any idea what the heck I'm doing wrong? (of course the files exist in the directory as shown)

Thanks in advance!

如果您有一个名为./assets/css/bootstrap.css的文件,并且配置了express.static以使./assets/为根目录,则URL应为/css/bootstrap.css

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