Mutations

Defining a mutation is similarly straight forward.

Resolvers with arguments

Notice how the createLink method, that will act as the resolver function for the createLink mutation, takes arguments of the name and type analogous to those defined in the mutation itself.

Creating links

Restart Jetty and test out your spiffy new mutation using GraphiQL:

Restart Jetty and test out your spiffy new mutation using GraphiQL

Re-run allLinks to verify your new link has indeed been persisted:

Re-run allLinks to verify your new link has indeed been persisted

Unlock the next chapter
How are mutations different from queries?
Only semantically, the syntax is the same for both
Mutation must be send via HTTP POST
Mutations start with a different key-word
Mutation is just another name for a query