/air_quality

Primary LanguageJavaScript

node version express mongoose Dependencies

Node.js - Express, MongoDB, REST API,CronJob Boilerplate

Features

  • 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
  • Logging with winston winston
  • Consistent coding styles with editorconfig
  • Gzip compression with compression
  • Periodic tasks and jobs cron
  • Linting with eslint
  • Tests with mocha, chai and sinon
  • Code coverage with Jest
  • Logging with morgan
  • API documentation generation with swagger-docs
  • To access the generated documentation :
localhost:8080/api-docs/

Prerequisites

Getting Started

  1. Clone the repo and make it yours:
git clone https://github.com/dfourcfive/air_quality.git
cd air_quality
  1. Install dependencies:
npm install
  1. use your IQAIR api key in dev.env:
API = YOUR_IQAIR_API_KEY
  1. Set environment variables:
  • note : this script must be excuted first!
bash to_dev.sh

Running Locally

node server.js

Test

# run all tests with Jest
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

# generate coverage reports
npm run coverage