Introducing the GraphQL API
In the last chapter, we created a backend with Express. The endpoint accepts JSON data as input and returns JSON data as a response. However, it can take any JSON data, which the backend may not expect. Also, there is no easy way to test our API endpoints without the frontend. This is something that we can solve with GraphQL APIs. GraphQL is a special query language that makes communication easier between the client and server. GraphQL APIs have a built-in data structure validation. Each property has a data type, which can be a simple or complex type, consisting of many properties with simple data types.
We can also test GraphQL APIs with GraphiQL, which is a web page that lets us make our own GraphQL API requests easily. Since there is a data type validation for each request, it can provide an autocomplete feature, according to the definition of the GraphQL API schema. The schema provides us with all the data type definitions that are used with queries...