Sha256: f3dd21634ffbbe4e3a38f3be6d1abe9d97bc36ef184c60701cf152ee8d433b1b

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

module RackGraphql
  class Application
    def self.call(schema:, app_name: 'rack-graphql-service', context_handler: nil, health_route: true)
      ::Rack::Builder.new do
        map '/graphql' do
          run RackGraphql::Middleware.new(schema: schema, context_handler: context_handler)
        end

        if health_route
          map '/health' do
            run ->(env) { RackGraphql::HealthResponseBuilder.new(app_name: app_name).build }
          end

          map '/' do
            run ->(env) { RackGraphql::HealthResponseBuilder.new(app_name: app_name).build }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-graphql-0.4.0 lib/rack_graphql/application.rb
rack-graphql-0.2.0 lib/rack_graphql/application.rb