Giter Site home page Giter Site logo

air-quality-api's Introduction

Air Quality API

REST API that exposes "the air quality information" of a nearest city to GPS coordinates

Requirements

  • Node.js
  • MongoDB

Setup

Clone the repository

git clone https://github.com/iamwebwiz/air-quality-api.git

Navigate to the cloned directory

cd air-quality-api

Install dependencies using npm, yarn or pnpm

yarn

Copy the contents of .env.example to .env

cp .env.example .env

Update the values of IQAIR_API_KEY and MONGODB_URI in the .env file

Start mongodb on your machine, then

Start the development server

yarn dev

Endpoints

/api/air-quality

Get the air quality for a given zone (longitude and latitude)

Query params (required):

  • longitude
  • latitude

Sample response:

{
  "Result": {
    "Pollution": {
      "ts": "2024-05-06T12:00:00.000Z",
      "aqius": 47,
      "mainus": "p2",
      "aqicn": 16,
      "maincn": "p2"
    }
  }
}

/api/air-quality/most-polluted

Get the date and time where the Paris zone is most polluted

Sample response:

{
  "Result": {
    "Date": "Mon May 06 2024",
    "Time": "16:00:00 GMT+0100 (West Africa Standard Time)"
  }
}

Testing

To run the available tests, run the following command:

yarn test

or

npm run test

or

pnpm test

air-quality-api's People

Contributors

iamwebwiz avatar

Watchers

 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.