No release in over 3 years
Low commit activity in last 3 years
GraphQL Playground provides a UI similar to GraphiQL with more features
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 5.1.0
 Project Readme

Gem Version

GraphqlPlayground::Rails

A blatant copy of GraphiQL::Rails with much less functionality but with GraphQL Playground instead.

Installation

Add this line to your application's Gemfile:

gem 'graphql_playground-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install graphql_playground-rails

Mount the Engine

Add the engine to routes.rb:

# config/routes.rb
Rails.application.routes.draw do
  # ...
  if Rails.env.development?
    mount GraphqlPlayground::Rails::Engine, at: "/graphql_playground", graphql_path: "/your/endpoint"
  end
end

Configure

# config/initializers/graphql_playground.rb
# All config options have a default that sould work out of the box
GraphqlPlayground::Rails.configure do |config|
  config.headers = {
    'X-Auth-Header' => ->(view_context) { "123" }
  }
  config.title = "Playground"
  config.csrf = true
  config.playground_version = "latest"
  # Ideally the assets would be added to your projects `vendor/assets` directories
  config.favicon = "/assets/playground.ico"
  config.playground_js_url = "/assets/playground.js"
  config.playground_css_url = "/assets/playground.css"
  # see: https://github.com/prisma-labs/graphql-playground#settings
  config.settings = {
    "schema.polling.enable": false
  }
end

Contributing

Submit a PR.

License

The gem is available as open source under the terms of the MIT License.