diff --git a/Relay-Pagination-example.md b/Relay-Pagination-example.md index e23900a..54658f3 100644 --- a/Relay-Pagination-example.md +++ b/Relay-Pagination-example.md @@ -4,7 +4,7 @@ For this example, we're going to assume a basic understanding of how [Relay pagi In a nutshell, `pagination` is implemented via graphene relay's `Connection` and `ConnectionField` pairing. With these in place, you'll see `pageInfo` available within your queries. It looks something like this: -``` +```json "pageInfo": { "startCursor": "YXJyYXljb25uZWN0aW9uOjQx", "endCursor": "YXJyYXljb25uZWN0aW9uOjQz", @@ -14,18 +14,18 @@ In a nutshell, `pagination` is implemented via graphene relay's `Connection` and ``` In addition to a `cursor` element within `edges` that will show you the cursor id for each element, like so: -``` - edges { - cursor - node { - - } - } +```graphql +edges { + cursor + node { + + } +} ``` The basic schema below provides relay cursor-based pagination, combined with graphene_django filter capability. -``` +```py from graphene import relay from graphene_django.types import DjangoObjectType from graphene_django.filter import DjangoFilterConnectionField @@ -44,7 +44,7 @@ class Query(object): ``` The following query, (the pageInfo element is included for illustration, but isn't necessary for the query to resolve): -``` +```graphql { places(first: 3, after: "YXJyYXljb25uZWN0aW9uOjQx") { pageInfo { @@ -65,7 +65,7 @@ The following query, (the pageInfo element is included for illustration, but isn ``` Gives us: -``` +```json { "data": { "places": {