Make sure you're using node >= 8.0.0 while working on this project
Make sure MongoDB service is running.
The config folder contains a file named db.js. Before running locally, change the value of db as seen in the code below.
module.exports = {
db: 'mongodb://localhost/mern-crud'
};For the back-end, install the dependencies once via the terminal.
npm installRun the main server. It listens on port 3000.
CORS=1 node serverView it on the browser.
If you want to configure the front-end, go to react-src folder via the terminal.
cd react-srcInstall the dependencies required by React once.
npm installRun the development server for React. It listens on port 4200.
REACT_APP_API_URL=http://localhost:3000 npm startTo make a production build, simply run on react-src folder via the terminal.
npm run buildIt re-creates a folder named public on the root directory. This is where the production-ready front-end of the web application resides.
docker-compose up