npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

covid19-graphql

v0.4.1

Published

Provides a GraphQL API for the COVID-19 data source from Johns Hopkins university

Downloads

52

Readme

COVID-19 GraphQL API

Build Status node version Maintenance MIT License

API Endpoint: covid19-graphql.herokuapp.com

This GraphQL API provides real-time, updated information on the COVID-19 cases across the world caused by the Coronavirus SARS-CoV-2.

Data is sourced from the Github repository and the OPS dashboard from Johns Hopkins university.

Features

  • Provides current, up-to-date statistics per country, subregion and region.

  • Provides timelines per country, subregion and region

  • Lightning fast due to smart caching and aggregation

  • Easy to run locally:

    npx covid19-graphql

Example GraphQL queries

Following are some example GraphQL queries:

Latest statistics

{
  latest {
    confirmed
    deceased
    recovered
    lastUpdated
  }
}

Execute this query »

Global timeline since March 2020, excluding China

{
  timeline(excludeCountries: "CN", from: "2020-03-01") {
    date
    confirmed
  }
}

Execute this query »

Latest statistics for each country in Southern Europe:

{
  subRegion(name: "Southern Europe") {
    countries(count: 20) {
      count
      totalCount
      hasNext
      results {
        name
        latest {
          lastUpdated
          deceased
        }
      }
    }
  }
}

Execute this query »

List all countries with confirmed cases, by region and subregion

{
  regions {
    name
    subRegions {
      name
      countries(count: 100, filter: { hasCases: true }) {
        results {
          name
        }
      }
    }
  }
}

Execute this query »

Running it yourself

In order to be in control of your own API endpoint instead of relying on someone else's, you can spin up a COVID19 GraphQL server locally with npx:

npx covid19-graphql

Or install it globally:

npm install -g covid19-graphql

Then you can start the GraphQL server by entering:

covid19-graphql

Environment variables

The following environment variables affect the configuration of the server:

  • NODE_ENV: When set to production, will disable tracing, playground and various other debugging settings. It will enable various performance optimizations.
  • PORT: Determines the HTTP port on which the server will run (defaults to port 12000)
  • ENABLE_TRACING: Overrides the default GraphQL tracing setting (on for development, off for production). Use 1 to turn on 0 to turn off.
  • ENABLE_PLAYGROUND: Overrides the default GraphQL playground flag (on for development, off for production). Use 1 to turn on 0 to turn off.

Example:

PORT=8080 covid19-graphql

Development

After cloning this repo, enter npm install to install the dependencies (btw Node >= 10 is required).

The following commands are most useful:

  • npm run dev: Starts a development server
  • npm run build: Creates a build
  • npm start: Starts the server