GraphQL Batch
This library is an alternative to batching with dataloader
that works with both graphql
and graphql-tools
.
Note: this is a fork of graphql-resolve-batch
, except we give users finer-grained control of their batching.
const UserType = // ...; const QueryType = name: 'Query' fields: user: type: UserType resolve:
Usage
Install graphql-batch
with
$ npm install --save graphql-batch graphql
or
$ yarn add graphql-batch graphql
and import it as
;
Examples
- This example batches up requests to
node
into a single request tonodes
const resolve = ) return Query: node: resolve
Note: the second parameter is optional and will default to use the first fieldName
as the key:
{ return infofieldNodes0namevalue}
Credits
- This is a fork of
graphql-resolve-batch
by@calebmer