Skip to content
⌛️ Express boilerplate for building RESTful APIs
JavaScript HTML Other
Branch: master
Clone or download

Latest commit

dependabot-preview and danielfsousa Bump email-templates from 6.0.4 to 6.0.6 (#250)
Bumps [email-templates](https://github.com/niftylettuce/email-templates) from 6.0.4 to 6.0.6.
- [Release notes](https://github.com/niftylettuce/email-templates/releases)
- [Commits](forwardemail/email-templates@v6.0.4...v6.0.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Latest commit c436884 Dec 14, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode Fix tests Oct 4, 2017
src Add password reset functionality (#224) Nov 25, 2019
.dockerignore chore: add .dockerignore file (#202) Oct 3, 2019
.editorconfig Commit files Jul 18, 2017
.env.example Add password reset functionality (#224) Nov 25, 2019
.eslintrc Add authorization tests Jul 18, 2017
.gitattributes Commit files Jul 18, 2017
.gitignore Remove package-lock.json Mar 18, 2018
.travis.yml Add password reset functionality (#224) Nov 25, 2019
CHANGELOG.md Update CHANGELOG Oct 4, 2017
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md (#200) Oct 1, 2019
CONTRIBUTING.md Update CONTRIBUTING.md Oct 1, 2019
Dockerfile Commit files Jul 18, 2017
LICENSE Initial commit Jul 18, 2017
README.md Change spelling of generation (#123) Oct 1, 2019
deploy.sh Commit files Jul 18, 2017
docker-compose.dev.yml Fix indentation in docker-compose.*.yaml files #94 (#96) Oct 9, 2018
docker-compose.prod.yml Fix indentation in docker-compose.*.yaml files #94 (#96) Oct 9, 2018
docker-compose.test.yml fix format in docker-compose.test.yml Sep 25, 2018
docker-compose.yml Commit files Jul 18, 2017
package.json Bump pm2 from 3.5.1 to 4.2.0 (#249) Dec 13, 2019
yarn.lock Bump email-templates from 6.0.4 to 6.0.6 (#250) Dec 13, 2019

README.md

Express ES2017 REST API Boilerplate

PRs Welcome npm version Build Status Coverage Status

Boilerplate/Generator/Starter Project for building RESTful APIs and microservices using Node.js, Express and MongoDB

Features

  • No transpilers, just vanilla javascript
  • ES2017 latest features like Async/Await
  • CORS enabled
  • Uses yarn
  • Express + MongoDB (Mongoose)
  • Consistent coding styles with editorconfig
  • Docker support
  • Uses helmet to set some HTTP headers for security
  • Load environment variables from .env files with dotenv
  • Request validation with joi
  • Gzip compression with compression
  • Linting with eslint
  • Tests with mocha, chai and sinon
  • Code coverage with istanbul and coveralls
  • Git hooks with husky
  • Logging with morgan
  • Authentication and Authorization with passport
  • API documentation generation with apidoc
  • Continuous integration support with travisCI
  • Monitoring with pm2

Requirements

Getting Started

Clone the repo and make it yours:

git clone --depth 1 https://github.com/danielfsousa/express-rest-es2017-boilerplate
cd express-rest-es2017-boilerplate
rm -rf .git

Install dependencies:

yarn

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

# run container in production
yarn docker:prod

# run tests
yarn docker:test

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

Tutorials

Inspirations

License

MIT License - Daniel Sousa

You can’t perform that action at this time.