Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Anatomy of a Query1:14 with Isaac Lee Morris
In this video, we will go over the different parts that make up a GraphQL query, before diving into each one in more detail in the videos that follow.
- Declaration - The keyword which starts every GraphQL query
- Endpoint - A section of a GraphQL backend responsible for returning a specific piece of all the data available
Tutorial: Getting started with GraphQL queries and mutations, by Tim Lucas
So you've gotten your first taste of GraphQL.
Now we're going to dive in and understand the different parts that make up a query.
In this video, we'll briefly go over each part before explaining them in more detail
in the videos that follow.
At its most basic, a query is composed of three parts,
the query declaration, the endpoint, and the fields.
The query declaration tells GraphQL that we'll only be retrieving information and
not making any changes.
In the curly braces following the query declaration,
we specify which endpoint or endpoints we'd like to call.
In this case, we're calling the topMoviebyRevenue endpoint,
which will return the top earning movie we have in our backend.
In the curly braces following the endpoint name,
we specify the fields we want returned for that endpoint.
This is how we tell GraphQL to include or
exclude certain properties from our response.
So that's the basic anatomy of a query.
In the next video,
you'll learn how to tell GraphQL which fields you want included in your response.
You need to sign up for Treehouse in order to download course files.Sign up