Skip to content

Instantly share code, notes, and snippets.

@kellysutton
Forked from anonymous/graphql-example.txt
Last active January 2, 2017 20:52
Show Gist options
  • Save kellysutton/aeb96e187f344beed28b0310df1a8d19 to your computer and use it in GitHub Desktop.
Save kellysutton/aeb96e187f344beed28b0310df1a8d19 to your computer and use it in GitHub Desktop.
Do we need GraphQL?
POST /graphql
Content-Type: application/graphql
{
post(id: 1) {
id
title
comments {
id
body
}
}
}
GET /api/posts/1?include=comments
Accept: application/vnd.api+json
POST /graphql
Content-Type: application/graphql
{
post(id: 1) {
id
title
comments {
id
body
}
}
}
// Our second client needs a `published_at`
POST /graphql
Content-Type: application/graphql
{
post(id: 1) {
id
title
published_at // This changes our cache key
comments {
id
body
}
}
}
POST /graphql
Content-Type: application/graphql
{
post(id: 1) {
id
title
published_at
comments {
id
body
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment