- Uses npm
- No transpilers, just vanilla javascript with ES2018 latest features like Async/Await
- Express + MongoDB (Mongoose)
- CORS enabled and uses helmet to set some HTTP headers for security
- Load environment variables from .env files with dotenv
- Request validation with joi
- Logging with winston winston
- File upload with multer
- Consistent coding styles with editorconfig
- 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
- Rate limiting with express-rate-limit
- API documentation generation with Apidoc
- Docker support
- Monitoring with pm2
Take a demo at Link Soon Coming...
- Clone the repo and make it yours:
git clone https://github.com/shekhar-raval/node-express-es8 node-api
cd node-api
rm -rf .git
- Install dependencies:
npm install
- Set environment variables:
cp .env.example .env
npm run dev
npm run start
# lint code with ESLint
npm run lint
# try to fix ESLint errors
npm run lint:fix
# lint and watch for changes
npm run lint:watch
# run all tests with Mocha
npm run test
# run unit tests
npm run test:unit
# run integration tests
npm run test:integration
# run all tests and watch for changes
npm run test:watch
# open nyc test coverage reports
npm run coverage
# run lint and tests
npm run validate
# generate and open api documentation
npm run docs
# run container in production
npm run docker:prod
or
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up
# run tests
npm run docker:test
or
docker-compose -f docker-compose.yml -f docker-compose.test.yml up
Change configuration in .env
file