Exercise: Query the supergraph
🎯 Goal: Build a query that enables the client to display the data needed for the mockup below.
Bonus
- Find the Explorer settings that shows you which subgraph is responsible for resolving each field.
- How can you view the query plan for your query?
Solution
Head over to Explorer.
We can now see the new fields available in the Documentation tab.
Build the query:
query HomepageWithLocationsAndActivities {... @defer {featuredLocation {idnamephoto}}locations {idnamephotodescription}activities {idnamephototerrainstats {groupSizeaverageTemperaturegravity}}}
Bonus:
Click the settings icon in the left panel and turn on Editor hints.
Turn on Subgraph source. Now you can see which subgraphs are responsible for which fields in your query!
Click the arrow beside Response and change to Query Plan Preview.
Share your questions and comments about this lesson
Your feedback helps us improve! If you're stuck or confused, let us know and we'll help you out. All comments are public and must follow the Apollo Code of Conduct. Note that comments that have been resolved or addressed may be removed.
You'll need a GitHub account to post below. Don't have one? Post in our Odyssey forum instead.