GithubHelp home page GithubHelp logo

diegomr86 / express-rest-boilerplate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danielfsousa/express-rest-boilerplate

0.0 1.0 0.0 2.52 MB

⌛️ Express starter for building RESTful APIs

License: MIT License

Shell 0.72% JavaScript 62.27% Dockerfile 0.15% HTML 16.58% Pug 20.29%

express-rest-boilerplate's Introduction

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

express-rest-boilerplate's People

Contributors

dependabot-preview[bot] avatar danielfsousa avatar dependabot[bot] avatar dependabot-support avatar greenkeeper[bot] avatar gkatsanos avatar irokhes avatar 3b3ziz avatar donnfelker avatar marcoswcarruda avatar mkutyba avatar mustafa60x avatar rahulkumar66 avatar isama92 avatar travislang avatar draysams avatar xantrix avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.