Tuesday, March 19, 2019

GraphQL API

Code | GraphQL

graphql-dotnet/graphql-dotnet: GraphQL for .NET

Getting Started with GraphQL in ASP.NET - Simple Talk


Serverless GraphQL with Tanmai Gopal - Software Engineering Daily


Building a GraphQL API with ASP.NET Core 2 and Entity Framework Core

"As our application grows, the number of REST endpoints we must build and maintain starts to explode. A growing number of endpoints demands more and more time and effort to test and support - on both the client and server. And if you eventually need to version your API, you've got a lot more to consider.

In GraphQL, we can define Query types in our Schema to retrieve (or mutate) any combination of types in our system through one endpoint i.e /api/graphql.
With types and a query defined in the schema, we can now issue requests via GraphQL similar to the RESTful ones listed above. However, we only need to send them to one endpoint. "


GET /api/graphql?query={ student(id: "10") { firstName, lastName, courses { title } } }
{
  "firstName": "Mark",
  "lastName": "Macneil",
  "email": "mark@fullstackmark.com",
  "courses": [
    {"title": "Advanced ASPNET Core" },
    {"title": "Introduction to GraphQL" }
  ]
}