January 2019
Intermediate to advanced
460 pages
10h 33m
English
One thing our client already offered was to add new posts to the fake data temporarily. We can realize this in the back end by using GraphQL mutations.
Starting with the schema, we need to add the mutation as well as the input types as follows:
input PostInput { text: String!}input UserInput { username: String! avatar: String!}type RootMutation { addPost ( post: PostInput! user: UserInput! ): Post}
GraphQL inputs are not more than types. Mutations can use them as parameters inside requests. They may look weird, because our current output types look almost the same. However, it would be wrong to have an id property on PostInput, for example, since the back end chooses the id and the client cannot give it. ...
Read now
Unlock full access