As we mentioned at the beginning of this chapter, GraphQL is an interesting technique that provides a query language for APIs. We can apply this to existing data to fulfil any queries that are requested. A key factor of GraphQL is that it provides an interesting and understandable description of the data that comes from an API. This strategy enables clients to ask for exactly what they need and nothing more. So, if, as a requester, I just want two fields, why should I receive a ton of unnecessary information? GraphQL makes the API easier to adapt to the current situation.
It is really recommended that you take a look at the GraphQL web page to learn more: https://graphql.org/.
In summary, a GraphQL service is composed of the following:
- Defining types and fields on those types
- Providing functions for each field on each type
Taking the example from the...