Gatsby + Marvel = gatsby-source-marvel

Gatsby source plugin to facilitate accessing the ton of content of the Marvel API

Configuration examples

The marvel API contains different entities and there are connections in (almost) every imaginable way. To get started you need to create your developer access

The plugin tries to facilitate constructing queries by letting you describe the resources you need. You still need to be a bit familiar with the API in order to know which filters you are allowed to use, and the different connections between the entities

Specifying resources along with an entity will retrieve all the available information for each resource connected to the entity filter. For example the example will retrieve all the available events associated with Thor. If you don't specify the resources then you only the first 20 results of each connection with the bare minimum information (as it happens on the marvel API)


{
  resolve: "gatsby-source-marvel",
  options: {
    publicKey: '---',
    privateKey: '---',
    limit: 100,
    queries: [
      {
        entity: 'characters',
        entityFilter: {
          name: 'Spider-Man',
        },
        resources: ['events'],
      },
      {
        entity: 'comics',
        entityFilter: {
          titleStartsWith: 'Civil War II',
        },
        resources: ['characters'],
      },
    ],
  }
}

Query example

The source plugin will create (depending on the configuration) the available nodes grouped by entity.

Available nodes are:

  • charactersNode & allCharactersNode
  • comicsNode & allComicsNode
  • eventsNode & allEventsNode
  • creatorsNode & allCreatorsNode
  • seriesNode & allSeriesNode


allComicsNode(
  filter: {
    characters : {
      elemMatch: {
        name: {in: ["Captain America", "Iron Man"]}
      }
    }
  }
) {
  edges {
    node {
      title
      thumbnail {
        path
        extension
      }
      prices {
        type
        price
      }
      characters {
        name
      }
    }
  }
}

Work in progress

I'll be trying to work on these problems soon. If you find a bug, thought of a feature or even want to share the cool usage of this plugin then you are welcome to create an issue

Avengers

1576

Earth's Mightiest Heroes joined forces to take on threats that were too big for any one hero to tackle. With a roster that has included Captain America, Iron Man, Ant-Man, Hulk, Thor, Wasp and dozens more over the years, the Avengers have come to be regarded as Earth's No. 1 team.

Captain America

2163

Vowing to serve his country any way he could, young Steve Rogers took the super soldier serum to become America's one-man army. Fighting for the red, white and blue for over 60 years, Captain America is the living, breathing symbol of freedom and liberty.