Skip to content

Node.js boilerplate for building RESTful APIs using Express, MongoDB, Passport, Mocha using ES2017(ES8) syntax

License

Notifications You must be signed in to change notification settings

IQ-SCM/express-es8-rest-boilerplate

 
 

Repository files navigation

Node.js - Express, MongoDB, ES2017 REST API Boilerplate

PRs Welcome Build Status Coverage Status Greenkeeper badge

Features

Take a demo at http://13.58.200.57:3000/docs/

Prerequisites

Getting Started

  1. Clone the repo and make it yours:
git clone https://github.com/ridhamtarpara/express-es8-rest-boilerplate node-api
cd node-api
rm -rf .git
  1. Install dependencies:
yarn
  1. Set environment variables:
cp .env.example .env

Running Locally

yarn dev

Running in Production

yarn start

Lint

# lint code with ESLint
yarn lint

# try to fix ESLint errors
yarn lint:fix

# lint and watch for changes
yarn lint:watch

Test

# run all tests with Mocha
yarn test

# run unit tests
yarn test:unit

# run integration tests
yarn test:integration

# run all tests and watch for changes
yarn test:watch

# open nyc test coverage reports
yarn coverage

Validate

# run lint and tests
yarn validate

Logs

# show logs in production
pm2 logs

Documentation

# generate and open api documentation
yarn docs

Docker

# run container locally
yarn docker:dev
or
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up

# run container in production
yarn docker:prod
or
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up

# run tests
yarn docker:test
or
docker-compose -f docker-compose.yml -f docker-compose.test.yml up

Deploy

Set your server ip:

DEPLOY_SERVER=127.0.0.1

Replace my Docker username with yours:

nano deploy.sh

Run deploy script:

yarn deploy
or
sh ./deploy.sh

Rate Limit Configuration

Change configuration in .env file

About

Node.js boilerplate for building RESTful APIs using Express, MongoDB, Passport, Mocha using ES2017(ES8) syntax

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.9%
  • Other 1.1%