Subdirectories not being served with express.static in heroku Subdirectories not being served with express.static in heroku express express

Subdirectories not being served with express.static in heroku


Make sure that the sub directories of your directory are added to your Git repository.

You can use heroku run 'ls ~' to help debug the issue (by observing the files on the dyno).

Putting the absolute path did not fix it for me. Your .gitignore may be excluding it.


Try changing your static dir to :

app.use(express.static(path.join(__dirname, '/../app'), { maxAge: 86400000 }));

or

app.use(express.static(path.normalize(path.join(__dirname, '../app')), { maxAge: 86400000 }));


add {{__dirname}}

<link href="{{__dirname}}/stylesheets/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>

in your layout.hbs or layout.jde