Class: Foobara::CommandConnectors::Http::Rack
- Inherits:
-
Foobara::CommandConnectors::Http
- Object
- CommandConnector
- Foobara::CommandConnectors::Http
- Foobara::CommandConnectors::Http::Rack
- Defined in:
- lib/foobara/command_connectors/http/rack.rb,
lib/foobara/command_connectors/http/puma_runner.rb,
lib/foobara/command_connectors/http/rack/request.rb,
lib/foobara/command_connectors/http/rack/response.rb
Defined Under Namespace
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#run_puma ⇒ Object
Just a convenience method for demos.
Instance Method Details
#call(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/foobara/command_connectors/http/rack.rb', line 5 def call(env) response = run(env) [response.status, response.headers, [response.body]] rescue NotFoundError, InvalidContextError => e [404, {}, [e.]] rescue => e # :nocov: env["rack.errors"].puts e.to_s env["rack.errors"].puts e.backtrace raise e # :nocov: end |
#run_puma ⇒ Object
Just a convenience method for demos. In real projects use rackup/config.ru or set it all up with ‘foob g rack-connector`
7 8 9 10 11 12 13 14 |
# File 'lib/foobara/command_connectors/http/puma_runner.rb', line 7 def run_puma(**) # :nocov: require "puma" require "rack/handler/puma" ::Rack::Handler::Puma.run(self, **) # :nocov: end |