This is an example GraphQL backend service that has support for the @defer
directive.
Please notice that this service uses experimental graphql-java APIs, and @defer
support in graphql-java is
still under very active development.
curl -v http://localhost:8080/graphql -H "Content-Type:application/json" --data \
'{"query": "query bookTestSimple { bookById(id: \"book-1\") { name ... @defer { author { firstName } } } ... @defer { book2: bookById(id: \"book-2\") { name } } }"}'
GraphiQL doen't work due to the GraphQL path being overridden, but you can use Apollo Sandbox instead.
Example query:
query bookTestSimple {
bookById(id: "book-1") {
name
... @defer {
author {
firstName
}
}
}
... @defer {
book2: bookById(id: "book-2") {
name
}
}
}