Jona
Jona

Reputation: 1061

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: enter image description here

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

Thanks in advance!

Upvotes: 0

Views: 1878

Answers (1)

robertklep
robertklep

Reputation: 203304

If you have a file called ./assets/css/bootstrap.css and you configure express.static so that ./assets/ is the root directory, the URL should be /css/bootstrap.css.

Upvotes: 1

Related Questions