Skip to content

Latest commit

 

History

History
77 lines (51 loc) · 3.13 KB

File metadata and controls

77 lines (51 loc) · 3.13 KB

Blog Home Page

Course Notes: API Development in .NET with GraphQL

Tags: .NET, API, Course, GraphQL, Notes

Table of Contents

  1. Introduction
  2. What is GraphQL.NET?
  3. Course Goals
  4. GraphiQL
  5. Queries
  6. Mutations
  7. Subscriptions
  8. Conclusion
  9. Comments

1. Introduction

"API Development in .NET with GraphQL" is a LinkedIn Learning course by Glenn Block that introduces API Development in .NET with GraphQL.

2. What is GraphQL.NET?

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.

3. Course Goals

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

4. GraphiQL

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
GraphiQL Editor and Docs

5. Queries

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
Queries in GraphiQL

6. Mutations

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
Mutations in GraphiQL

7. Subscriptions

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
Subscriptions in GraphiQL

8. Conclusion

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)

9. Comments

Reply to this tweet.