项目作者: jack0pan

项目描述 :
Mount GraphQL Playground for Rails App
高级语言: Ruby
项目地址: git://github.com/jack0pan/graphql-playground-rails.git
创建时间: 2019-06-25T07:19:10Z
项目社区:https://github.com/jack0pan/graphql-playground-rails

开源协议:MIT License

下载


GraphQL Playground

Mount the GraphQL Playground in Ruby on Rails.

Requirement

Rails >= 5.2.0

Installation

Add this line to your application’s Gemfile:

  1. gem 'graphql-playground'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install graphql-playground

Usage

Mount the Engine

Add the engine to routes.rb:

  1. # config/routes.rb
  2. Rails.application.routes.draw do
  3. # ...
  4. if Rails.env.development?
  5. mount GraphQL::Playground::Engine, at: "/graphql-playground", graphql_path: "/graphql"
  6. end
  7. end
  • at: is the path where GraphQL Playground will be served. You can access GraphQL Playground by visiting that path in your app.
  • graphql_path: is the path to the GraphQL endpoint. GraphQL Playground will send queries to this path.

If you’re using Rails 5 in “API mode”, you’ll also need to add require “sprockets/railtie” to your application.rb.

Contributing

Contribution directions go here.

License

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