Skip to content

Latest commit

 

History

History
87 lines (63 loc) · 2.63 KB

README.md

File metadata and controls

87 lines (63 loc) · 2.63 KB

GrAMPS · An easier way to manage the data sources powering your GraphQL server

GrAMPS GraphQL Data Source for xkcd

license npm version Build Status Maintainability Test Coverage Greenkeeper badge

Load the latest xkcd comic, or look one up by its ID.

This is a GrAMPS data source for GraphQL.

Example Queries

To get all available fields for this data source, try out these two queries in GraphiQL. (See the quickstart for details on starting GraphiQL.)

query getLatestComic {
  getLatestComic {
    ...ComicFields
  }
}

query getComicById($id: ID!) {
  getComicById(id: $id) {
    ...ComicFields
  }
}

fragment ComicFields on XKCD_Comic {
  num
  title
  safe_title
  img
  alt
  transcript
  year
  month
  day
  link
  news
}

Use the following arguments:

{
  "id": 1900
}

Quickstart

# Clone the repo
git clone [email protected]:gramps-graphql/data-source-xkcd.git

# Move into it
cd data-source-xkcd/

# Install dependencies
yarn install

To Develop with Mock Data

Start the app with the following command:

# Develop with mock data
yarn dev:mock-data

Open the URL displayed in your console to see GraphiQL.

To Develop with Live Data

Once you’ve got your data source configured to load live data, you can enable live data in development:

# Develop with live data
yarn dev

Open the URL displayed in your console to see GraphiQL.

Notes for Developers

Currently, there is no watch capability (PRs welcome!), so the service needs to be stopped (control + C) and restarted (yarn [dev:mock-data|dev]) to reflect new changes to the data source.