Sha256: 39b582f43d5954616051bd133b8f4ea9e0ad701fc60fc47127604d231795f722

Contents?: true

Size: 760 Bytes

Versions: 3

Compression:

Stored size: 760 Bytes

Contents

module RackGraphql
  class Application
    def self.call(schema:,
                  app_name: 'rack-graphql-service',
                  context_handler: nil,
                  health_route: true,
                  health_response_builder: RackGraphql::HealthResponseBuilder)
      ::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) { health_response_builder.new(app_name: app_name, env: env).build }
          end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-graphql-0.6.0 lib/rack_graphql/application.rb
rack-graphql-0.5.2 lib/rack_graphql/application.rb
rack-graphql-0.5.0 lib/rack_graphql/application.rb