A template for any Nodejs project!
- Docker
- Logger
- Rate Limit
- Validation schema
.
├── logs
| └── logger.js # Logger file to log success, logical and error codes
├── models
| └── dbInit.js # Connection to the mongo database
├── routes
| └── test.js # Test route
├── tools
| └── error_codes.js # File containing a list of all codes
├── utils
| └── validation_schema.js # Schema to validate req.body
├── .env
├── .gitignore
├── package.json
├── package-lock.json
├── Dockerfile
├── docker-compose.yml
├── app.js
├── CODE_OF_CONDUCT.md
└── README.md
- To install latest version of npm
npm install -g npm@latest
- Clone the repo
git clone https://github.com/vidhik2002/Nodejs-Template.git
- Replace .env.sample with .env and insert the Mongo URL
- Run the command
nodemon app.js
To update the existing packages to latest version
npm update
If some of those updates are major releases, running npm update
won't update the version of those.
To update all packages to a new major version, install npm-check-updates.
- To install the
npm-check-updates
package globally
npm install -g npm-check-updates
- To update all packages
ncu -u
Run the following commands
1. docker build . -t <your username>/<name-of-node-application> --network=host
2. docker images
3. docker run -p 3000:3000 -d <your username>/<name-of-node-application>
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'feat: Add some AmazingFeature'
) - Push to the Branch (
git push -u origin feature/AmazingFeature
) - Open a Pull Request