No commit activity in last 3 years
No release in over 3 years
A rack middleware wrapper for GraphQL Playground
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

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)