Skip to content

betaflag/graphql-playground-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This gem is a simple middleware wrapper for GraphQL Playground, a GraphQL IDE for better development workflows (GraphQL Subscriptions, interactive docs & collaboration).

gem install graphql_playground

Usage

If you use rack, you can mount it like this

require 'graphql_playground'

map '/playground' do
  use GraphQLPlayground, endpoint: '/graphql' # endpoint to your graphql server endpoint
end

Example using graphql_server gem

# app.ru
require 'graphql_playground'
require 'graphql_server'

type_def = <<-GRAPHQL
  type Query {
    hello: String
  }
GRAPHQL

resolver = {
  "Query" => {
    "hello" => Proc.new { "world" }
  }
}

map '/playground' do
  use GraphQLPlayground, endpoint: '/'
end

run GraphQLServer.new(type_def: type_def, resolver: resolver)

Launch it with

rackup app.ru

And then open http://localhost:9292/playground

(Reference https://github.com/betaflag/graphql-server-ruby)

About

A rack middleware wrapper for GraphQL Playground

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published