/node-rest-starter

:fire: A boilerplate for creating RESTful APIs in Node.js using Express and MongoDB. :tada: :tada:

Primary LanguageJavaScriptMIT LicenseMIT

Node Rest Starter 🌿

Build Status Coverage Status dependencies Status Maintainability Inline docs License

A boilerplate for creating RESTful APIs in Node.js using Express and MongoDB. It is written with all the best practices in the world 😊



Technologies

Getting Started

Prerequisites

Initial Setup

# Clone the repo
$ git clone git@github.com: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

Testing

# 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

Linting

# Lint code using ESLint
$ npm run lint

Docker

# Build docker image
$ docker-compose build

# Start newly built image
$ docker-compose up

Api Doc

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

Directory Structure

+
+---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

Development Screenshots

API logs

Test logs

Highly Inspired by

License

This project available under the MIT license.


Made with  💖  by Sk Arif.