This repository is the codebase for an Air Quality Index (AQI) Viewer, which displays air quality data, collected and measured at monitoring stations around the world. To build the viewer, I used a free and publicly accessible Real-time Air Quality Data Feed, a JSON API provided by the World Air Quality Index project.
- If you do not already have a private API key, request one here.
- Create a
.env
and pass the token as a string toAQICN_TOKEN
.
API_HOST="https://api.waqi.info/feed/"
AQICN_TOKEN="example API key"
-
If you already have Node installed, check the installed version by running
node -v
and seeing that it returnsv18.18.0
. If you need to install it, and if you are using nvm, run:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
...or if you are using asdf, run:
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install nodejs 14.17.6
-
Install package.json dependencies into the
node_modules/
directorynpm install
Run development server:
npm run dev
or
next dev
Tests are located in a single file: cypress/e2e/app.cy.js
To run tests, run:
npx cypress run --spec cypress/e2e/app.cy.js
Note: Cypress waits until the dev server is accessible before running tests, so be sure to start the dev server with npm run dev
before running tests.
Alternatively, you can run tests in Cypress desktop app:
npx cypress open
Click on E2E testing, choose your preferred browser, and click "Start E2E Testing."