Sha256: 986511951dcd1954e0db6d6aa02ef70b71d7c5beab729adabf1a492b3d4f9172

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 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 '/healthz' 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

1 entries across 1 versions & 1 rubygems

Version Path
rack-graphql-0.7.1 lib/rack_graphql/application.rb