Skip to content

Express REST API server boilerplate with passport authentication, ES6 support, jest/supertest testing, precommit formatting and testing, logging and error handling integrated.

T-A-G/Express-API-Boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔥Express API Boilerplate

Simple express boilerplate for creating REST API server.

✅Features

  1. Authentication with email/password and JWT authentication using passport.js(without blacklisting).
  2. API rate limiting using express-rate-limit.
  3. Test integration using Jest and Supertest.
  4. Logging using morgan.
  5. Error handling(here).
  6. ODM using Mongoose.js.
  7. Precommit code formatting using prettier and testing using husky.
  8. ES6 support with babel.js.

⚙️ Environment variables

Variable Name. description example
JWT_SECRET secret for generating JWT Q>,L+A+6
MONGO_DB MongoDB connection uri string mongodb://localhost:27017/Biolerplate
JWT_TOKEN_EXPIRATION_IN_DAYS period after which JWT should expire 7
RATE_LIMIT_WINDOW the window in which api calls from a specific IP address can only make a specific amount of request determined in RATE_LIMIT the environment variable. ⚠️ This value is in Milliseconds 60000 (equivalent to one minute)
RATE_LIMIT amount of api calls from a specific IP address that can be made within a given time window determined in the RATE_LIMIT_WINDOW the environment variable. 100

🏁Getting started

Installing packages

npm i

Development

run from root:

npm run start

Testing

run from root:

npm run test

if you want to auto rerun tests on file change run:

npm run test:watch

Deploy

run from root:

npm run build

npm run serve

About

Express REST API server boilerplate with passport authentication, ES6 support, jest/supertest testing, precommit formatting and testing, logging and error handling integrated.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published