Express js route 404 error only in prod

I've been working on building a video conferencing application by following this tutorial.

It's a great tutorial, and everything worked awesome when developing. However, when pushing to production I had issues and I'm not well-versed enough with these tools to figure out what's wrong.

I changed my NODE_ENV=PROD in my .env file. Which should trigger the production express build located here. (tutorial github link)

Next, I ran npm run build as I wanted to build my bundle.js, etc in the dist/ directory. I copied the three files from dist/,


Into my web server's directory, but now when visiting /token route, I get a 404. This doesn't happen on DEV, so it has to be something with the way the express server.js is written.

Unfortunately, I'm having trouble deducing what the issue is.

Environment details - I'm using a hostgator account, and copying files into the cpanel file manager. I've hosted lot's of JS applications like this before, but usually if I'm using a back-end it's a django server, so this (express) is new for me.

1 answer

  • answered 2018-04-17 04:21 Farhan Tahir

    It is because express server is not running in your production environment. As express is used to build web server listening on specific port. In your case you have deployed the static files but the server is not running.