module Rack::Handler::Falcon
The falcon adaptor for the `rackup` executable.
Constants
- NAME
- SCHEME
The default scheme.
Public Class Methods
endpoint_for(**options)
click to toggle source
Generate an endpoint for the given `rackup` options. @returns [Async::IO::Endpoint]
# File lib/rack/handler/falcon.rb, line 20 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) { |server| ... }
click to toggle source
Run the specified app using the given options: @parameter app [Object] The rack middleware.
# File lib/rack/handler/falcon.rb, line 29 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