module Rack::Handler::Falcon
def self.endpoint_for(**options)
Generate an endpoint for the given `rackup` options.
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)
Run the specified app using the given options:
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, protocol: Async::HTTP::Protocol::HTTP1, scheme: SCHEME) yield server if block_given? Async::Reactor.run do server.run end end