New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

gatsby-source-nhl

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-nhl

A Gatsby source plugin to load resources from the NHL API.


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created

CI semantic-release

gatsby-source-nhl

A Gatsby source plugin for sourcing data into your Gatsby application from the NHL.

The plugin creates nodes from portions of the NHL API. It allows you to query data such as teams, players, stadiums and more.

Install

npm install --save gatsby-source-nhl

Disclaimer

This is an unofficial plugin and is using the publicly accessible parts of the NHL API. There is nothing stopping the NHL to restrict the API or to push out break changes.

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: 'gatsby-source-nhl',
      options: {},
    },
  ],
};

How to query

You can query team nodes using the following:

{
  allNhlTeam {
    edges {
      node {
        teamName
        shortName
        name
      }
    }
  }
}

Querying dynamic information

You may run into cases where you want up to date information such as statistics on players and teams. To do this you would need to fetch data on the client, not at build time. You can read more about this here.

Most nodes have an attribute called externalId which you can query. This is the Id used by the NHL to identify records. You'll need to use this Id when querying parts of their api.

FAQs

Package last updated on 17 Feb 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