Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 1 month 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-06-02T11:41:32.000Z (over 4 years ago)
- Last Synced: 2024-09-28T21:42:42.934Z (about 2 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: 2
- 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)
[![license](https://img.shields.io/npm/l/@gramps/data-source-xkcd.svg)](https://github.com/gramps-graphql/data-source-xkcd/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/@gramps/data-source-xkcd.svg?style=flat)](https://www.npmjs.com/package/@gramps/data-source-xkcd) [![Build Status](https://travis-ci.org/gramps-graphql/data-source-xkcd.svg?branch=master)](https://travis-ci.org/gramps-graphql/data-source-xkcd) [![Maintainability](https://api.codeclimate.com/v1/badges/ac264833fac1fbd1afe0/maintainability)](https://codeclimate.com/github/gramps-graphql/data-source-xkcd/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/ac264833fac1fbd1afe0/test_coverage)](https://codeclimate.com/github/gramps-graphql/data-source-xkcd/test_coverage) [![Greenkeeper badge](https://badges.greenkeeper.io/gramps-graphql/data-source-xkcd.svg)](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 [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:
```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.