Running a Query
We are going to use what we developed in the previous step.
To query the Recipes Manager GraphQL API, tartiflette-aiohttp
embeds the GraphiQL client, available at this address http://localhost:8080/graphiql when your server is live.
Get all the recipes
Copy/paste this GraphQL Query to your GraphiQL instance and execute it.
{
recipes {
id
name
cookingTime
}
}
Get all the recipes with ingredients
The power of GraphQL is to be able to get many different resources in a single request.
We will execute a request to retrieve the recipes with all the ingredients.
query {
recipes {
id
name
cookingTime
ingredients {
name
quantity
type
}
}
}
Get only one recipe
Below, a request to select only one recipe, by its id
.
{
recipe(id: 1) {
id
name
cookingTime
ingredients {
name
quantity
type
}
}
}