Implementing GraphQL
Providing GraphQL support to the WorldCities app requires some back-end and front-end level work. Here are the tasks we’re going to address in this section:
- Add GraphQL support to ASP.NET Core with the HotChocolate third-party library
- Add GraphQL support to Angular using the Apollo Angular GraphQL client
- Test the server-side and client-side integration with Visual Studio
Let’s put this plan into action.
Adding GraphQL to ASP.NET Core
If we want to provide our existing ASP.NET Core app with GraphQL support, we need to add a GraphQL layer to the HTTP pipeline that can perform the following tasks:
- Expose an API endpoint that clients will use to send their GraphQL queries
- Process the incoming queries using our existing data model
- Retrieve the requested data from the underlying DBMS
- Provide the response with the resulting data in JSON format
Implementing these features from...