https://github.com/gramps-graphql/data-source-xkcd
A GrAMPS data source to load the latest xkcd comic, or look one up by its ID.
https://github.com/gramps-graphql/data-source-xkcd
apollo-server-express apollographql gramps gramps-data-source graphql graphql-server xkcd
Last synced: 8 months ago
JSON representation
A GrAMPS data source to load the latest xkcd comic, or look one up by its ID.
- Host: GitHub
- URL: https://github.com/gramps-graphql/data-source-xkcd
- Owner: gramps-graphql
- License: mit
- Created: 2017-10-22T18:45:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-02T11:41:32.000Z (about 6 years ago)
- Last Synced: 2025-09-27T11:16:43.208Z (9 months ago)
- Topics: apollo-server-express, apollographql, gramps, gramps-data-source, graphql, graphql-server, xkcd
- Language: JavaScript
- Homepage: https://ibm.biz/gramps-graphql
- Size: 6.15 MB
- Stars: 12
- Watchers: 1
- Forks: 3
- Open Issues: 33
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GrAMPS GraphQL Data Source for [xkcd](https://xkcd.com)
[](https://github.com/gramps-graphql/data-source-xkcd/blob/master/LICENSE) [](https://www.npmjs.com/package/@gramps/data-source-xkcd) [](https://travis-ci.org/gramps-graphql/data-source-xkcd) [](https://codeclimate.com/github/gramps-graphql/data-source-xkcd/maintainability) [](https://codeclimate.com/github/gramps-graphql/data-source-xkcd/test_coverage) [](https://greenkeeper.io/)
Load the latest [xkcd](https://xkcd.com) comic, or look one up by its ID.
This is a [GrAMPS](https://ibm.biz/gramps-graphql) 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](#quickstart) for details on starting GraphiQL.)
```graphql
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:
```json
{
"id": 1900
}
```
## Quickstart
```sh
# 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:
```sh
# 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:
```sh
# 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.
