4. Create your Query schema

# app/graphql/query_type.rbTypes::QueryType=GraphQL::ObjectType.definedoname"Query"# Add root-level fields here.# They will be entry points for queries on your schema.field:allPlaylists,types[Types::PlaylistType]dodescription"Playlists that belong to the user"resolve->(obj,args,ctx){Playlist.all.map{|x|x}}endend

This creates a new field titled allPlaylists for your queries. This field is then further defined within the resolve block to further interact with your data model.

5. Success! 🎉

Now, when you visit your localhost:8080/graphiql you are able to query your data using GraphQL— like so:

query{allPlaylists}

This methodology was used to create Spotless-API, a helper-project I created that uses GraphQL to interface with the Spotify API.