- Start the apollo gql server with yarn start
- Open a new terminal and run
yarn start-mesh
- A new browser tab should open the GraphiQL Editor on port 4001
- Use the following query
mutation Test {
A: changeName(name: "A")
B: changeName(name: "B")
C: changeName(name: "C")
D: changeName(name: "D")
}
- Go to the terminal output of the apollo gql server and check the
req.body
. There are 4 requests instead of 1.
The apollo gql server, which is a handler of the GQL Mesh, receives 1 request with all mutations inside of it.
The default graphql-js
execute function calls executeFieldsSerially
which breaks down the concept behind the batch-executor of graphql-tools
https://github.com/graphql/graphql-js/blob/main/src/execution/execute.ts#L379
https://www.graphql-tools.com/docs/batch-execution#batch-the-executor