Skip to content

AlaeddineMessadi/COVID-19-REPORT-API

Repository files navigation

COVID-19-REPORT-API

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

Preview




Get Started

Prerequisites

npm or yarn installed

# clone the repo
$ git clone https://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 a brief timeseries 
[GET]   /api/v1/cases/brief/timeseries

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

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

examples:
[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]   /api/v1/cases/latest?onlyCounties=true
[GET]   /api/v1/cases/latest?iso=AU&province=New+South+Wales
[GET]   /api/v1/cases/latest?province=New+South+Wales

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

examples:
[GET]   /api/v1/cases/timeseries
[GET]   /api/v1/cases/timeseries?onlyCounties=false
[GET]   /api/v1/cases/timeseries?iso=DE
[GET]   /api/v1/cases/timeseries?iso=AU&province=New+South+Wales
[GET]   /api/v1/cases/timeseries?province=New+South+Wales
[GET]   /api/v1/cases/timeseries?iso=CH&onlyCounties=true

# Secret me list of contries/regions with iso2 and iso3
[GET]   /api/v1/cases/countries

# 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

Total alerts

Deployment

$ now

Deploy with ZEIT Now

Data Source

data repository for the 2019 Novel Coronavirus Visual Dashboard operated by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE)

MIT License

MIT license forthebadge

Support: