So far in our example app, we have only been fetching data from our GraphQL API endpoint. In this lesson, we’ll learn how to modify data on our server using GraphQL.
In a REST API, we typically use GET requests to fetch something, and POST / PUT / PATCH / UPDATE requests to change data on the server.
In GraphQL, however, the distinction is a bit simpler:
query
when we need to fetch datamutation
when we need to modify anythingLet’s explore how to edit a book’s information, and look at how this affects the Apollo cache and how the changes are reflected in our Vue app.
updateBook
mutation