'Express static assets in sub folders work on localhost, not on AWS elastic beanstalk

My static assets all work just fine when running my node/express app locally. When I deploy it to AWS elastic beanstalk however, the only assets that are available are the ones not nested past public/assets/css, public/assets/js, public/assets/svg etc.

If the file path is public/assets/svg/flags/filename it doesn't work on the deployed app, but does work on local host.

public/assets/svg/filename would work however.

this is how I set my static assets path:

app.use('/public', express.static(path.join(__dirname, 'public')))

this has forced me to put all my css in the public/assets/css folder, all my svgs in my public/assets/svg folder, and so on. I can't create additional sub folders to organize things and it's extremely annoying.

What am I doing wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source