Sha256: f5e0b2fd73e4537e42fec4498b34639f5e585aead45b8ebae472762a9d7b5c38

Contents?: true

Size: 718 Bytes

Versions: 14

Compression:

Stored size: 718 Bytes

Contents

require 'rack/handler'

require_relative '../../falcon'

require 'async/io/host_endpoint'

module Rack
	module Handler
		module Falcon
			SCHEME = "http".freeze
			
			def self.endpoint_for(**options)
				host = options[:Host] || 'localhost'
				port = Integer(options[:Port] || 9292)
				
				return Async::IO::Endpoint.tcp(host, port)
			end
			
			def self.run(app, **options)
				endpoint = endpoint_for(**options)
				
				app = ::Falcon::Adapters::Rack.new(app)
				app = ::Falcon::Adapters::Rewindable.new(app)
				
				server = ::Falcon::Server.new(app, endpoint, Async::HTTP::Protocol::HTTP1, SCHEME)
				
				Async::Reactor.run do
					server.run
				end
			end
		end
		
		register :falcon, Falcon
	end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
falcon-0.22.1 lib/rack/handler/falcon.rb
falcon-0.22.0 lib/rack/handler/falcon.rb
falcon-0.21.0 lib/rack/handler/falcon.rb
falcon-0.20.3 lib/rack/handler/falcon.rb
falcon-0.20.2 lib/rack/handler/falcon.rb
falcon-0.20.1 lib/rack/handler/falcon.rb
falcon-0.20.0 lib/rack/handler/falcon.rb
falcon-0.19.6 lib/rack/handler/falcon.rb
falcon-0.19.5 lib/rack/handler/falcon.rb
falcon-0.19.4 lib/rack/handler/falcon.rb
falcon-0.19.3 lib/rack/handler/falcon.rb
falcon-0.19.2 lib/rack/handler/falcon.rb
falcon-0.19.1 lib/rack/handler/falcon.rb
falcon-0.19.0 lib/rack/handler/falcon.rb