0.2.0 • Published 4 years ago

gatsby-source-mathdroid-covid19 v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

gatsby-source-mathdroid-covid19

Provides a Gatsby source plugin for the API made possible by mathdro.id's excellent work.

Getting Started

Add the plugin to your gatsby-config.js file along with a list of countries whose data you want to fetch (if any).

module.exports = {
  ...
  plugins: [
    {
      resolve: 'gatsby-source-mathdroid-covid19',
      options: {
        countries: [{ iso2: 'DE' }],
      },
    }
  ]
}

From there you will have GraphQL nodes available like the following:

query MyQuery {
  covid19GlobalSummary {
    confirmed
    recovered
    deaths
    image
  }
  allCovid19CountrySummary {
    nodes {
      country
      confirmed
      recovered
    }
  }
  allCovid19ProvinceStateDetail(filter: {iso2: {eq: "US"}}, limit: 5, sort: {order: DESC, fields: [confirmed]}) {
    nodes {
      provinceState
      confirmed
      recovered
      deaths
    }
  }
}

Plugin Options

See the Covid19PluginOptions type in src/nodes/types.ts

Contributing

This plugin is still pretty barebones, so pull requests are more than welcome.

Ways to help

[] Get Jest up and running with some tests [] Dynamically fetch data from the Gatsby GraphQL queries? [] Make the Gatsby GraphQL nodes feel more native [] Nest related data structures in GraphQL

Supporting

Donate to mathdro.id or Johns Hopkins for their hard work