A REST API responsible for exposing “the air quality information” of the nearest city to GPS coordinates using iqair.
To run the program, follow these steps:
- Clone this repository to your local machine or download zip file.
- Setup your .env variables as described in the
env.example
file. - Run the program using
docker compose up
.
Running with docker compose automatically start the Cron Job
Or run it manually:
npm install
npm run start:dev
The app should be available via http://localhost:8080/health.
To run cron job, run npm run cron:start
To stop cron job, run npm run cron:stop
To run the tests, use the command docker compose -f docker-compose.test.yml up
.
Or run it manually:
npm install
npm run test
After starting up your server by following the commands in the Getting started section, you could send a request to get air quality for a specified zone 5. Example request:
curl 'http://localhost:8080/api/v1/air-quality?latitude=48.856613&longitude=2.352222&key={{YOUR_API_KEY}}'
The program assumes that that ou have correct value in your .env file as described in the env.example
file.
Due to time constraints, some features have been deprioritized, including:
- spin up a new child process to run CronJob
- optional task