From the course: Spring with GraphQL
Unlock the full course today
Join today to access over 24,200 courses taught by industry experts.
Mutations - Spring Tutorial
From the course: Spring with GraphQL
Mutations
- [Instructor] That was very easy to get a GraphQL server up and running. We did it in about 15 minutes. But now we need to actually do more than just query the data, because very few services exist that don't have the ability to modify data. So that's our next step. Let's go create a mutation. All right. So let's open up hplus, source, main, resources, graphql. And let's open up our schema. Now, when you're building a mutation, you need to create a specific type for that mutation. And it's called an input. So we will create a CustomerInput. And our CustomerInput is basically going to be the exact same as the Customer, without the ID. Because in our case, the Customer itself gets its ID from the identity and that comes from the database. So we don't need to specify that on the input. Now, if you were going to use the exact same object to create it, you would still have to create another instance or use an…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Setting up the project4m 18s
-
(Locked)
Creating the schema4m 5s
-
(Locked)
Creating a Spring Data repository5m 41s
-
(Locked)
Creating the GraphQL controller6m 44s
-
(Locked)
Mutations5m 32s
-
(Locked)
Errors4m 8s
-
(Locked)
Challenge: Extending the API1m 19s
-
(Locked)
Solution: Extending the API4m 4s
-
(Locked)
-