GraphqlPlaygroundRails
This is a Rails Engine that simply mounts the GraphQL
Playground inside your Rails
app.
There are several other gems doing the same thing, but somehow I haven't been
able to make any of them work in Rails 6.0.
Usage
Mount it in your Rails app by editing config/routes.rb
as such:
Rails.application.routes.draw do
if Rails.env.development?
mount GraphqlPlaygroundRails::Engine, at: '/gql', graphql_path: '/graphql'
end
end
You will be able to access the playground at http://localhost:3000/gql
after
you restart your Rails server.
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
Acknowledgements
The structure of the engine has been inspired by
graphiql-rails, which mounts
GraphiQL rather than GraphQL Playground.
The code to show the GraphQL Playground comes from the graphql-playground
repository.
Contributing
Pull requests are welcome.
License
The gem is available as open source under the terms of the MIT License.