Adding Mutations to Our Schema

作者:禅与计算机程序设计艺术

1.简介

The general goal of GraphQL mutations is to update the server-side state of a resource based on the input provided by the client. However, adding mutations to our schema requires additional work and knowledge. In this article, we will explore how to add mutations to our schema using Apollo Server and write an example application to demonstrate how it works in practice. We’ll start with some background information about mutations before diving into the specifics of implementing them.

2.Background

In traditional REST APIs, updates are typically implemented as HTTP PUT requests that modify existing resources or create new ones if they don't exist yet. In contrast, GraphQL mutations have several advantages:

  1. They allow clients to specify precisely what changes should be made to the server-side data without having to worry about overloading GET requests or creating separate endpoints

猜你喜欢

转载自blog.csdn.net/universsky2015/article/details/132785174