gatsby-source-canonic

1.0.1 • Public • Published

Canonic Gatsby Source Plugin

A Gatsby source plugin to pull data from Canonic APIs. Once installed, your API can be queried from within Gatsby using GraphQL.

Release npm version

Install

yarn add gatsby-source-canonic

Configureation

After installing the plugin, use and configure the plugin by modifying your site's gatsby-config.js.

// gatsby.config.js

module.exports = {
  plugins: [
    //...other plugins
    {
      resolve: 'gatsby-source-canonic',
      options: {
        url: "YOUR_API_URL",
        apiKey: process.env.CANONIC_ACCESS_TOKEN
      }
    }
  ]
}

It's recommended to use dotenv to configure env variables and store the token there.

You can create an access token by visiting the settings page of your Canonic project. Read More

Usage

Once the plugin is configured, you can query for Canonic data as you would from any other source

{
  allTABLE_NAME {
    edges {
      node {
        _id
        ...
      }
    }
  }
}

TABLE_NAME is the key for the table corresponding to Canonic. So if you created a table called movies, the query name would be allMovie

You can read more on how to write more advanced queries here

Dependents (0)

Package Sidebar

Install

npm i gatsby-source-canonic

Weekly Downloads

0

Version

1.0.1

License

0BSD

Unpacked Size

7.12 kB

Total Files

11

Last publish

Collaborators

  • pratham.agrawal92