Skip to content

Instantly share code, notes, and snippets.

@loriculberson
Last active June 22, 2023 23:34
Show Gist options
  • Save loriculberson/ab4ce617ff26eba0226fda48cc664c03 to your computer and use it in GitHub Desktop.
Save loriculberson/ab4ce617ff26eba0226fda48cc664c03 to your computer and use it in GitHub Desktop.

MERN Deployment

Backend App

Resource: 

  1. Push code to heroku git push heroku main
  2. Seed db by accessing heroku’s terminal heroku run bash then run the seed command
  3. To test, use a POST request in Postman with the new backend heroku url + /graphql

Frontend App

  1. Add a buildpack to the frontend app on Heroku. Settings -> Add buildpack -> paste this in: https://github.com/mars/create-react-app-buildpack

image

  1. In the frontend app run npm run build. This will create a build directory.
  2. Where ever you have set the value of the httpLink, (maybe the App.js), make the uri dynamic based on if we’re in a development or production. You need YOUR backend URL that you'll have after deploying the backend to Heroku.

image

App structure

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment