Load the latest xkcd comic, or look one up by its ID.
This is a GrAMPS data source for GraphQL.
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
}
# Clone the repo
git clone git@github.com:gramps-graphql/data-source-xkcd.git
# Move into it
cd data-source-xkcd/
# Install dependencies
yarn install
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.
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.
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.