Module: ElasticGraph::Rack::GraphiQL

Defined in:
lib/elastic_graph/rack/graphiql.rb

Overview

A Rack app that exposes both a GraphQL endpoint and an admin UI using GraphiQL:

github.com/graphql/graphiql/tree/graphiql%402.4.0

Class Method Summary collapse

Class Method Details

.new(graphql) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/elastic_graph/rack/graphiql.rb', line 18

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