This chapter covers
- Describing the requirements of our business review application
- Translating requirements into GraphQL type definitions
- Implementing resolver functions for data fetching for these type definitions, using a naive approach
- Using Apollo Server to combine our type definitions and resolvers and serve a GraphQL endpoint
- Querying our GraphQL endpoint with Apollo Studio
In this chapter, we will design a GraphQL API for a business review application. First, we will define the requirements of this application; then, we will describe a GraphQL API that addresses these requirements following a GraphQL-first development approach. We then explore how to implement the data fetching logic for this API. Finally, we explore how to combine our GraphQL type definitions and resolver functions to serve a GraphQL API using Apollo Server and to query it, using Apollo Studio. When building APIs, it is often useful to understand the data domain and the common access patterns—in other words, what are the problems to be solved by the API? The GraphQL-first development approach allows us to build APIs by first considering the data domain and defining a GraphQL schema describing that domain, which then serves as a blueprint for implementing the API.