Table of Contents
Last updated
January 9, 2019
GraphQL Queries
Add type, query and schema for graphql
Now we need to add a type for Speaker, also a query and a schema for GraphQL.
We need to then add a root query in query.rb
file.
And include the query in the schema.
Querying the endpoint
You can use the GraphiQL app or the Postman app to query the endpoint. Make sure that you have puma running and the server is up.
A JSON response like the below will be obtained.
Now you have a GraphQL server up and running on sinatra, and you can query the endpoint to get a list of speakers with the fields defined in the GraphQL query.
In the next part we will add mutations.
…