Module: Rack::Handler::Falcon

Defined in:
lib/rack/handler/falcon.rb

Class Method Summary collapse

Class Method Details

.endpoint_for(**options) ⇒ Object



9
10
11
12
13
14
# File 'lib/rack/handler/falcon.rb', line 9

def self.endpoint_for(**options)
  host = options[:Host] || 'localhost'
  port = Integer(options[:Port] || 9292)
  
  return Async::IO::Endpoint.tcp(host, port)
end

.run(app, **options) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/rack/handler/falcon.rb', line 16

def self.run(app, **options)
  endpoint = endpoint_for(**options)
  
  server = ::Falcon::Server.new(app, endpoint)
  
  Async::Reactor.run do
    server.run
  end
end