Module: Rack::Handler::Falcon
- Defined in:
- lib/rack/handler/falcon.rb
Overview
The falcon adaptor for the `rackup` executable.
Constant Summary collapse
- SCHEME =
The default scheme.
"http"
- NAME =
:falcon
Class Method Summary collapse
-
.endpoint_for(**options) ⇒ Object
Generate an endpoint for the given `rackup` options.
-
.run(app, **options) {|server| ... } ⇒ Object
Run the specified app using the given options:.
Class Method Details
.endpoint_for(**options) ⇒ Object
Generate an endpoint for the given `rackup` options.
20 21 22 23 24 25 |
# File 'lib/rack/handler/falcon.rb', line 20 def self.endpoint_for(**) host = [:Host] || 'localhost' port = Integer([:Port] || 9292) return Async::IO::Endpoint.tcp(host, port) end |
.run(app, **options) {|server| ... } ⇒ Object
Run the specified app using the given options:
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rack/handler/falcon.rb', line 29 def self.run(app, **) endpoint = endpoint_for(**) 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 |