A boilerplate for creating RESTful APIs in Node.js using Express and MongoDB. It is written with all the best practices in the world 😊
- Node.js, Express, Javascript, npm - core platform
- Helmet, compression, cors - common middlewares
- MongoDB, Mongoose - database and schema modeling
- JWT, express-jwt - generate and validate access token
- Joi, express-validation - param validation
- Consola, Logger - better console logging stuff
- ESLint - check and fix linting of code
- Jest - unit testing javascript code and api
- Husky - precommit hooks for git
- apiDoc - documentation for RESTful apis
# Clone the repo
$ git clone [email protected]:skarif2/node-rest-starter.git awesomeapi
# Change directory to newly created one
$ cd awesomeapi
# Install dependencies
$ npm install
# Setup environment
$ cp .env.example .env
# Start development server
$ npm start
# Watch for file changes
$ npm run start:watch
# Run server in debug mode
$ npm run start:debug
# Run tests in normal mode
$ npm test
# Run tests in watch mode
$ npm run test:watch
# Generate coverage report for tests
$ npm run test:coverage
# Lint code using ESLint
$ npm run lint
# Build docker image
$ docker-compose build
# Start newly built image
$ docker-compose up
Inline documentation for RESTful APIs. ApiDoc creates a documentation from API annotations in the source code. [more] ApiDoc demo for this repo.
# Generate documentation for RESTful Api
$ npm run apidoc
+
+---docs
+---src
| +---__test__
| +---api
| | +---auth
| | | auth.controller.js
| | | auth.param.js
| | | auth.route.js
| | +---user
| | | user.controller.js
| | | user.model.js
| | | user.param.js
| | | user.route.js
| +---config
| | environment.js
| | express.js
| | mongoose.js
| +---libs
| | APIError.js
| | jwToken.js
| +---middleware
| | index.js
| | index.route.js
| package.json
| .env
- Express & mongoose REST API Boilerplate in ES6 with Code Coverage
- Vue, Express, MongoDB full-stack JS Boilerplate
- Node.js API Starter Kit
This project available under the MIT license.