tim
tim

Reputation: 220

trouble deploying full stack application on heroku

I have made a full-stack app with react js and node js with express and MongoDB but I am having a little bit of difficulty deploying I first tried to deploy the front end but I was getting the invalid host header coming up when I tried to deploy in Heroku its been tested and works fine in the dev environment.

But also my application has two separate git repos one for the back and one for the front end and every tutorial I have seen to deploy they always have the client in the same folder as the server.

Can someone either tell me how to deploy or point me in the right direction on how to deploy.

Upvotes: 0

Views: 313

Answers (1)

Abhay Desai
Abhay Desai

Reputation: 253

What you have to do for React/Express/Node/MongoDB is,

  1. build your frontend app first by using "npm run build". This will create a build folder under your app folder.
  2. move your "build" folder to backend app folder.
  3. update your backend app to use "app.use(express.static('build'))".

Then you can push your code to git and Heroku and try to deploy it.

There should be some tutorials available on Heroku website.

Upvotes: 1

Related Questions