@gramps/data-source-xkcd

2.0.0 • Public • Published

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 git@github.com: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.

Readme

Keywords

Package Sidebar

Install

npm i @gramps/data-source-xkcd

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

12.9 kB

Total Files

9

Last publish

Collaborators

  • molyholy
  • jake.henderson
  • ryanomackey
  • jlengstorf