Tags: .NET, API, Course, GraphQL, Notes
Table of Contents
- Introduction
- What is GraphQL.NET?
- Course Goals
- GraphiQL
- Queries
- Mutations
- Subscriptions
- Conclusion
- Comments
"API Development in .NET with GraphQL" is a LinkedIn Learning course by Glenn Block that introduces API Development in .NET with GraphQL.
GraphQL.NET is an open source library for building a GraphQL server. A client can perform queries, mutations and subscriptions to a GraphQL endpoint. This library supports .NET Framework (.NET Standard) and .NET Core.
Learn how to use GraphiQL (pronounced "graphical"), an interface that can execute GraphQL requests and serve API documentation.
Create a GraphQL server that supports:
- Queries to get data
- Mutations to add or modify data
- Subscriptions to subscribe to data events via a "push" mechanism
GraphiQL is a browser-based editor to execute queries and mutations against a GraphQL API server. GraphiQL also hosts API documentation.
GraphiQL Editor and Docs |
Below is an example query in GraphiQL. The query specifies what type of data and which properties to return. Note the nested customer
property which is linked to the Customer
object.
Queries in GraphiQL |
Below is an example mutation in GraphiQL to create a record (an order) and update a record (start an order). $order
is a variable with its value specified in the Query Variables window.
Mutations in GraphiQL |
Below is an example subscription in GraphiQL. Clients that subscribe to a pre-defined will get a push notification when the event occurs. In this case, one client (upper right window) subscribes to the order created event. Another client (lower right window) subscribes to the order started event. When a subscribed event occurs, the event details will show up in the window that says "Your subscription data will appear here after server publication!".
Subscriptions in GraphiQL |
This course is a practical introduction to GraphQL with real examples. Here are some related topics further research:
- Authentication and authorization
- Subscription performance (eg. how do connections scale, etc)
- HTTP request equivalent of GraphQL queries
- Usage with SPA frameworks (eg. Reactjs)
Reply to this tweet.