This project does not have a mongoDB connection setup. Setup the connection based on the environments below.
- local development: create a config file (make sure to name it config.js) in the config folder, which exports your db.uri connection. An example is provided, config/config.example.js. This file will be ignored by git so your db credentials will be kept safe when the app is deployed.
- production: Since the config file is not pushed when you deploy your app, you must specifiy your db uri in heorku. Set the uri in heroku as specified in this resource. Make sure you name the environement variable "DB_URI".
This app can be deployed directly to heroku since there is a script defined in package.json which will automatically handle building and deploying the app. For more information on deploying to heroku reference the extra resources at the bottom of this file.
Please note that any time the server is run in these scripts nodemon
is used in place of node
for easier development. If you are interested in how this works follow the nodemon In the project directory, you can run:
Runs both the client app and the server app in development mode.
Open http://localhost:3000 to view the client in the browser.
Runs just the client app in development mode.
Open http://localhost:3000 to view the client in the browser.
Runs just the server in development mode.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
If deploying to heroku this does not need to be run since it is handled by the heroku-postbuild script
See the section about deployment for more information.
To learn how to setup a local MongoDB instance for testing, check out how to connect to MongoDB.
To learn how to deploy a full-stack web app to heroku, check out this great guide.
To learn React, check out the React documentation.