Boilerplate for node applications with express framework
License: MIT License
Dockerfile 0.27%JavaScript 99.73%
node-express-boilerplate's Introduction
๐ Tech stack
Node
Express
React
Mongo
Docker
๐ General Instructions
๐ Create .env file by copying contents of .env.sample file
๐ท๏ธ By default Node server will run on port 5000 and React will run on port 3000 (In case if needed to change this behaviour modify the .env file inside the app directory)
โจ Make sure the port 5000 and 6000 of the host machine is not used by other services since docker attaches the backend service to port 5000 and mongodb to 6000 of the host machine (To change this behaviour modify the .env file inside the root directory)
โป๏ธ .env file inside the app directory will be used while running without docker and .env file at root directory will be used while running with docker
๐ To run the project without docker
Starting backend (Node server)
Navigate to backend/app directory
Run the command npm install
Run the command npm start
Seed the database with user's data by using the command npx mongoose db:seed:all
๐ณ To run the project using docker
Navigate to backend directory
Run the code docker-compose up -d
Find the container ID of node container by using the command docker ps
Access the docker container shell using the command docker exec -it CONTAINER_ID sh (Replace the CONTAINER_ID with actual container id obtained from the previous step)
Seed the database with user's data by using the command npx mongoose db:seed:all