Home > other >  Trying to deploy PERN app in Heroku and getting 404s
Trying to deploy PERN app in Heroku and getting 404s

Time:08-10

I'm trying to get my app and server hosted on Heroku to work when deployed, but it's not. Client and server seem appear to be running, but the api calls are returning 404s. I'm guessing the configs are messed up somewhere.

Here is my repo: https://github.com/kpermenter/test-deploy and my Heroku settings are attached.

Any insight would be much appreciated!heroku configs

CodePudding user response:

This is because you haven't made the client files available publicly, you can do this by using: app.use(express.static('../client/build'));

in the server.js file if this doesn't work you can try creating a 'public' folder inside the server folder then copy the contents of the build inside the server/public folder and then use app.use(express.static('/public')); and just deploy the server folder itself

  • Related