Module: ElasticGraph::Rack::GraphiQL
- Defined in:
- elasticgraph-rack/lib/elastic_graph/rack/graphiql.rb
Overview
A Rack application that serves both an ElasticGraph GraphQL endpoint and a GraphiQL IDE. This can be used for local development, mounted in a Rails application, or run in any other Rack-compatible context.
Class Method Summary collapse
-
.new(graphql) ⇒ Rack::Builder
Builds a Rack application that serves both an ElasticGraph GraphQL endpoint and a GraphiQL IDE.
Class Method Details
.new(graphql) ⇒ Rack::Builder
Builds a Rack application that serves both an ElasticGraph GraphQL endpoint and a GraphiQL IDE.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'elasticgraph-rack/lib/elastic_graph/rack/graphiql.rb', line 31 def self.new(graphql) graphql_endpoint = ElasticGraph::Rack::GraphQLEndpoint.new(graphql) ::Rack::Builder.new do use ::Rack::Static, urls: {"/" => "index.html"}, root: ::File.join(__dir__, "graphiql") map "/graphql" do run graphql_endpoint end end end |