Boilerplate/Starter Project for building RESTful APIs and microservices using Node.js, Express and MongoDB.
To get the Node server running locally:
- Clone this repo
npm install
oryarn install
to install all required dependencies- Install MongoDB Community Edition (instructions) and run it by executing
mongod
npm run start
to start the local servernpm run test
to excute the test casesnpm run build
to build the project.
- expressjs - The server for handling and routing HTTP requests
- mongoose - For modeling and mapping MongoDB data to javascript
- morgan - HTTP request logger middleware for node.js
- http-status - Utility to interact with HTTP status code.
- joi - Object schema description language and validator for JavaScript objects.
- cors - CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
- environment.js - Projects specific config's are defined here. (Like PORT, Mongo URI, etc..)
- test/ - This folder contains the project test cases.
- src/config - This folder contains api specific config.
- src/api/routes - This folder contains the route definitions for our API.
- src/api/controllers - This folder contains the controllers definitions for our API.
- src/api/models - This folder contains the schema definitions for our Mongoose models.
- src/api/utils - This folder contains the utils definitions for our API.
- src/api/middlewares - This folder contains the middlewares definitions for our API.