Introduction
Hot Chocolate is an open-source GraphQL server for .NET which is compatible with all GraphQL compliant clients like Strawberry Shake, Relay, Apollo Client, and various other GraphQL clients and tools. It takes away a lot of complexity so that building an application is faster.
Hot Chocolate is one of three products by the company ChilliCream focusing on GraphQL, the other 2 are:
- Strawberry Shake - A GraphQL client for consuming GraphQL APIs in .NET
- Banana Cake Pop - An IDE for creating/exploring and testing GraphQL APIs
This video gives a good introduction to Hot Chocolate:
GraphQL operations
With a REST API we have certain operations we can do like GET, PUT, POST, etc. requests. In GraphQL there are also operation types, those are:
An operation has the following structure:
- Operation keyword: Which operation we want to execute
- Operation name: A name we give to our operation (doesn't have to be unique)
- Variables: We can pass in variables to our operations
- Selection Sets: A selection set defines an ordered set of selections (the data we want to query for instance)
- Field: GraphQL is about asking for specific fields on objects
- Root Field Selection: Field on the Root Selection Set are called Root Field Selection