Socket
Book a DemoInstallSign in
Socket

covidtracking

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

covidtracking

Covid-19 Tracking API Client

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

Covid Tracking API Client

JavaScript HTTP client for making requests to Covid Tracking API. Use it in your server-side (Node.js) or browser applications to fetch Covid tracking data.

Installation

npm install covidtracking

Usage

Initialize the client

The module exports the covidtracking Object. Just import the module and you are ready to make calls.

const covidtracking = require('covidtracking');

Call a method

The covidtracking object has a named method for each of the endpoints in the Covid Tracking API. All named methods return a Promise which resolves with the response data or rejects with an error.

(async () => {
  // Get recent daily numbers for [US](https://covidtracking.com/api/states).
  const data = await covidtracking.us.daily();
 
  // Display the data
  console.log(data);
})();

Methods list

  • States current - states() | states.csv()
  • States daily - states.daily() | states.daily.csv()
  • States info - states.info() | states.info.csv()
  • US current - us() | us.csv()
  • US daily - us.daily() | us.daily.csv()
  • Counties- counties() | counties.csv()
  • Tracker URLs - urls()
  • State Website Screenshots - screenshots()

If you want to apply filter to us.daily(), you can pass query strings as objects { state: 'NY' } to only show cases in New York. Or { state: 'NY', date: '20200316'} to show the result of a specific date.

const data = await covidtracking.us.daily({
  state: 'NY', 
  date: '20200316'
});

Requirements

This package supports Node v8 LTS & higher and works on all modern browsers.

License

MIT

Covid Tracking API

Keywords

covid-tracking

FAQs

Package last updated on 29 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts