Skip to content
Alaeddine edited this page Mar 22, 2020 · 1 revision

COVID-19-REPORT-API

COVID-19-REPORT-API is an API Service to keep tracking COVID-19 cases worldwide

Get Started

Prerequisites

npm or yarn installed

# clone the repo
$ git clone git@github.com:AlaeddineMessadi/COVID-19-REPORT-API.git

# install dependencies
$ yarn    ## or npm install

# run in development mode
$ yarn dev   ## npm run dev

# run tests
$ yarn test  ## npm run test

Run the service

Run in development mode:

Runs the application is development mode. Should not be used in production

$ yarn dev
## or with debug
$ yarn dev:debug

Run in production mode:

Compiles the application and starts it in production production mode.

$yarn compile
$ yarn start

Documentation

# Get me a brief report
[GET]   /api/v1/cases/brief

# Get me all latest cases in the world or in specific region or country
[GET]   /api/v1/cases/latest   # queries {iso: String , onlyCountries: Boolean}

#! iso parameter can be iso2 or iso3 for example: US or USA , CN or CHN

exemples:
[GET]   /api/v1/cases/latest
[GET]   /api/v1/cases/latest?onlyCounties=true
[GET]   /api/v1/cases/latest?iso=US
[GET]   /api/v1/cases/latest?iso=US&onlyCounties=true

# Get me al timeseries in the world or in specific region or country
[GET]   /api/v1/cases/timeseries   # queries {iso: String , onlyCountries: Boolean}

exemples:
[GET]   /api/v1/cases/timeseries
[GET]   /api/v1/cases/timeseries?onlyCounties=false
[GET]   /api/v1/cases/timeseries?iso=DE
[GET]   /api/v1/cases/latest?iso=CH&onlyCounties=true

# Secret endpoint to update Database
[GET]   /api/v1/cases/udpate?secret=secret

#! change your secret in the .env file


# Get ALL 
[GET]   /api/v1/cases

#! response will be huge!! 

Test It

Run the Mocha unit tests **TO DO: ** more tests to implement

$ yarn test
## or
$ yarn test:debug

Try It

  • Open you're browser to http://localhost:3000
  • Invoke the /cases endpoint
    curl http://localhost:3000/api/v1/cases/brief

Lint It

Fix all prettier linter errors

$ yarn lint

Deployment

$ now

MIT License

MIT license forthebadge