Nice Philanthropist Metalhead
    Wondering what’s next for npm?Check out our public roadmap! »

    @wyze/gatsby-source-graphql

    1.2.0 • Public • Published

    @wyze/gatsby-source-graphql

    Build Status npm Codecov.io

    A Gatsby source plugin for pulling in data from GraphQL APIs.

    Installation

    Yarn

    $ yarn add @wyze/gatsby-source-graphql
    

    npm

    $ npm install --save @wyze/gatsby-source-graphql
    

    Usage

    With gatsby-source-filesystem

    // gatsby-config.js
     
    // Optionally pull in environment variables
    require('dotenv').config({
      path: `.env.${process.env.NODE_ENV}`,
    });
     
    module.exports = {
      // ...
      plugins: [
        {
          resolve: 'gatsby-source-filesystem',
          options: {
            name: 'queries',
            path: `${__dirname}/src/queries/`,
          },
        },
        {
          resolve: '@wyze/gatsby-source-graphql',
          options: {
            headers: {
              authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
            },
            url: 'https://api.github.com/graphql',
          },
        },
      ]
    }
    # src/queries/github.graphql
    {
      viewer {
        name
        url
      }
    }

    How to query

    Given the above example with a GraphQL file named github.graphql, you would query Gatsby like so:

    query GitHubViewerQuery {
      githubGraphQl {
        viewer {
          name
          url
        }
      }
    }

    Change Log

    Full Change Log

    v1.2.0 (2018-07-27)

    • [ac57b7ab69] - Rename package under my named scope (Neil Kistner)
    • [befa28c85f] - Allow the use of a mapper function between results and nodes (#6) (Judah Anthony)

    License

    MIT © Neil Kistner

    Install

    npm i @wyze/gatsby-source-graphql

    DownloadsWeekly Downloads

    6

    Version

    1.2.0

    License

    MIT

    Unpacked Size

    25.2 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar