Ricardas
Ricardas

Reputation: 548

Apollo GraphQL map list entities from multiple sources

There is an entity list that has data from two sources. Dimensions like id, name, label, ... and metrics like games played, wins and so on. Those are stored in different endpoints. I want to query filtered data from one source and having ids ask for data from another source at once, not by one entity by one of all entities? A primary set of the list can be queried from both or resources depending on sort options.

Upvotes: 0

Views: 589

Answers (1)

Ionut Achim
Ionut Achim

Reputation: 977

You could define a query that accepts one or a list of arguments. The resolver would make the two requests and when the responses come back, merge them and return the merged list.

Check out this launchpad for an example of what I'm saying.

Upvotes: 1

Related Questions