Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tspecht/e9f7cbbb726b3bd61c8adc2391cd6cfc to your computer and use it in GitHub Desktop.
Save tspecht/e9f7cbbb726b3bd61c8adc2391cd6cfc to your computer and use it in GitHub Desktop.
Example of relay-style cursor-based pagination in GraphQL
query Pokemons($trainerID: Int!, $first: Int, $after: String) {
pokemons(trainerID: $trainerID, first: $first, after: $after) {
edges {
cursor
node {
id
name
species {
name
}
# ...
}
}
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment