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.env) in the config folder, which exports your db.uri connection. An example is provided, server/config/config.env This file will be ignored by git so your db credentials will be kept safe when the app is deployed.
-
production: Make sure you name the environement variable "DB_URI".
Since this project will hold both the client application and the server application there will be node modules in two different places. First run npm install
from the root. After this you will run npm run-script install-all
from the root. From now on run this command anytime you want to install all modules again. This is a script we have defined in package.json .
Create an Atlas URI connection parameter in mern/server/config.env
with your Atlas URI:
ATLAS_URI="your mongodb connection string"
PORT=5000
PORT = 4000
DB_URI =
JWT_SECRET =
JWT_EXPIRE =
COOKIE_EXPIRE =```
Start server:
cd mern/server
npm install
npm start
Start Web server
cd mern/client
npm install
npm start
In the project directory, you can run:
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.
You can learn more in the Create React App documentation.
To learn how to setup a local MongoDB instance for testing, check out how to Connect to MongoDB.
To learn React, check out the React documentation.