Skip to content

mahesh-gunjal/e-commerce-server

Repository files navigation

Node.JS Boilerplate - JavaScript RESTful APIs

A production ready boilerplate/starter project for quickly building RESTful APIs using Node.js, Express, and Mongoose. Authentication using JWT, request validation, API documentation, pagination, etc. For more details, check the features list below.

Quick Start

You may need to make the .env file and set environment variables in it. Refer .env.example

Dependencies Installation

Run the following command.

npm install

or

yarn install 

Table of Contents

Functionalities

  • Database: MongoDB object data modeling using Mongoose
  • Authentication and authorization: using jwt
  • Validation: request data validation using Joi
  • Logging: using winston and morgan
  • Error handling: error handling mechanism is centralized
  • Process management: advanced production process management using PM2
  • Dependency management: with NPM
  • Environment variables: using dotenv and cross-env
  • Security: set security HTTP headers using helmet
  • Sanitizing: sanitize request data against xss and query injection
  • CORS: Cross-Origin Resource-Sharing enabled using cors
  • Compression: gzip compression with compression
  • Git hooks: with husky and lint-staged
  • Linting: with ESLint

Commands

Running locally:

npm run dev

Running in production:

npm start

Testing:

# run all tests
npm run test

# run all tests in watch mode
npm run test:watch

# run test coverage
npm run coverage

Linting:

# run ESLint
npm run lint

# fix ESLint errors
npm run lint:fix


## Linting

Linting is done using [ESLint](https://eslint.org/).

To modify the ESLint configuration, update the `.eslintrc.json` file.

To prevent a certain file or directory from being linted, add it to `.eslintignore`.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published