Fetch relational data from multiple data sources using nested resolvers
Fetch relational data from multiple data sources using nested resolvers
We do not have flat data structures on production data. we have a parent-child relationship on data and also parent and child may stay in two different data sources. for example, Employees may store in a database but projects may be stored on some other location and exposed via Rest endpoint. this video shows how we can use GraphQL to expose a single endpoint for these multi-data sourced relational data.
Apollo Server needs to know how to populate data for every field in your schema so that it can respond to requests for that data. To accomplish this, it uses resolvers.
A resolver is a function that’s responsible for populating the data for a single field in your schema. It can populate that data in any way you define, such as by fetching data from a back-end database or a third-party API.