gatsby-source-morty

0.3.3 • Public • Published

Gatsby MortyCMS Source

A gatsby plugin that runs a graphql query and parses it's response based on a schema to get your data properly into gatsby's world.

Usage

Add the following with your settings to the gatsby-config.js file under plugins:

{
  resolve: `gatsby-source-morty`,
  options: {
    account: `awesome-co`,
    accessToken: `00000000-0000-0000-0000-000000000000`
  }
},

For development, you can just add gatsby-source-morty to plugins and it will point to localhost:3000/graphql.

Process / Workflow

  1. Download and cache the schema from the server (utils/getSchema)
  2. Build client scheme from that schema
  3. Parse the client query to query AST and operation AST
  4. Gather fragment definitions
  5. Validate the query is valid for the schema
  6. Run query against server
  7. Use the type info of the schema to walk through the operations
  8. Recursively make nodes from the data, using fragments as needed

Package Sidebar

Install

npm i gatsby-source-morty

Weekly Downloads

0

Version

0.3.3

License

Unlicense

Unpacked Size

254 kB

Total Files

14

Last publish

Collaborators

  • danielfarrell
  • danielsellergren
  • mattclough