I'm seeing some really odd behavior where some of my files are correctly being returned by my express/node server (using express.static()
), but not files within subdirectories. The frustrating thing is that it works fine using node or foreman locally, it just won't work on heroku. This gist has the main files at play here, and my app structure looks like this:
-app
- index.html
- img/
- base.png
- sub/
- sub.png
- scripts
- base.js
- sub/
- sub.js
- css
- base.css
- sub/
- sub.css
- server
- app.js
The index.html, and base.* files all load fine, it's just the sub.* files that 404. Seems bizarre that express.static would go 1 level deep, but not 2
I've tried a slew of different configurations, including this stackoverflow answer. I have to be missing something simple. Thanks for the help.
UPDATE:
When I console.log the following on server startup on heroku, I get:
path.join(__dirname, '../app')
=/app
path.join(__dirname, '/../app')
=/app/app
path.normalize(path.join(__dirname, '../app'))
=/app/app
path.join(process.cwd(), '../app')
=/app/app