rans>Skip to main content
Community Plugin
View plugin on GitHub
See starters using this

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
Docs
Tutorials
Plugins
Blog
Showcase