Viewing the deployed application
Learning the GraphQL language is a topic in and of itself. In this section, I'll show some queries and mutations using the Insomnia client on macOS. Insomnia is a client application that can be used to make standard REST API requests and also has a lovely GraphQL interface when working with GraphQL endpoints.
A simple query to get a list of cupping sessions, returning only the ID and name of the Sessions, looks like the following:
query allSessions {
sessions {
id
name
}
}When you think back to the implementation of the Query class, you might recall the following:
class Query(graphene.ObjectType):
sessions = graphene.List(SessionObject, id=graphene.Int(),
account_id=graphene.Int())Hopefully, things are becoming clearer now. The preceding query is named allSessions, and inside it's explicitly asking for sessions. Our GraphQL code responds in kind by noticing that the query is for sessions and invoking...