We're going to walk you how to deploy a MERN stack app to Heroku.
MERN (Mongo, express, React, and Nodejs)
Create an mongo db atlas account and setup the the network and database access
Create an config.env
file in the root directory and add the folloing in
PORT=5000
MONGO_URI= <Your mongo db uri>
NODE_ENV=development
To test the application you can use the temporary data provided in utils
folder
To upload the data
node utils/importData.js --import
This will test the database and create an post collection in the database
In the root directory
yarn install && yarn start
cd client
yarn install && yarn start
Once we have the above steps completed, we can run the following commands to create a heroku app, configure mlab, and push our code to heroku open terminal at root directory
heroku create app_name
heroku addons:create mongolab:sandbox
git add -A
git commit -m "add_message"
git push heroku master
heroku open