Join Glenn Block for an in-depth discussion in this video What we're going to build, part of API Development in .NET with GraphQL.
- [Instructor] Throughout this course, we're going to build a graph QL server from scratch. The server will expose an order management graph QL endpoint which will allow querying, mutations, and subscriptions. It will allow you to use the graphical editor for interactively issuing requests against the server. Let me show you the final project working. So you can see here, I've got multiple instances of the graphical editor running. So the first thing we'll be able to do is issue queries.
You can see here that I've created a query called get orders. And I actually get syntax completion which is really nice that the graphical editor gives me. So let's go and run that query. So I'm going to go here and say, get orders. And you can see the orders that are coming back in the information. Now, you're also seeing the power of graph QL in that I can navigate the graph of related objects. So you see that I also have the customer ID and name being returned for each entry. So that allows me to retrieve data. Now, the other thing that we're going to learn is how to do mutations.
Mutations are actually updating state. So you can see here that I have a create order mutation. And down here, I've defined the order that I'm going to create. Now, we're also going to be learning about subscriptions. So I'm going to mention this now because the two are connected. Over on the right, you'll see that I have two instances that are subscribed to get notifications from the graph QL server whenever changes happen. I have one listening for created. I have the other listening for process. So we're going to go now and create this order and we should see that one of those will receive a notification.
And it does. You can see here that this order event has been fired which tells me that this order has created. So now, what I'm going to do is copy that order ID and I'm going to come over here to this start order which is a second mutation. And I'm going to replace the order ID that is there with the new order ID of the order that was just created. Okay, I've done that. So now, I'm going to run the second mutation which is the start the order.
And we can see that that order shows up as being in a process state. So this is just showing you the final result. We're going to have a lot of fun building this from scratch in the course.
- Creating a new GraphQL project
- Exposing a new GraphQL API
- Enabling and creating mutations
- Updating and configuring the schema
- Enabling subscriptions
- New GraphQL.NET schema classes
- Creating the OrderEventType