Template for building projects with the MERN (MongoDB, Express, React, Node.js) stack.
This template was generated using create-next-app and express-generator for the
client and server, respectively.
- Install Node and npm here
- Install
yarnwith the commandnpm install -g yarn - Set up a MongoDB Atlas instance. See this video for help!
- Create a
.envfile with a variable calledDB_URLand paste your MongoDB url:
DB_URL=mongodb://mongodburl.example.com:portnumbercdintoclientand run the commandyarn installto install all dependencies- To start the client, run
yarn devin the same directory - In another command window,
cdintoserverand runyarn installandnpm startto install all dependencies and start the server. - To kill a port, use 'npx kill-port <PORT_NUMBER>'
- For Linux/Mac use 'sudo lsof' to see what ports are active.
- For Windows, use 'netstat -a -b'
- If you want to change the port for server, head to the server/bins/www.
Look for the line
var port = normalizePort(process.env.PORT || '3001');Change it to any port you like! - Happy hacking!