gatsby-source-morty

v0.3.3
Gatsby source plugin for building websites using the Morty CMS as a data source
gatsby gatsby-plugin gatsby-source-plugin graphql morty

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
npm i gatsby-source-morty

Metadata

Downloads