Class: Heartcheck::App
- Inherits:
-
Object
- Object
- Heartcheck::App
- Defined in:
- lib/heartcheck/app.rb
Constant Summary collapse
- ROUTE_TO_CONTROLLER =
A hash with paths as keys and controllers as values we use it in #dispath_action to routes the requests
{ '/' => Controllers::Essential, '' => Controllers::Essential, '/functional' => Controllers::Functional, '/dev' => Controllers::Dev, '/info' => Controllers::Info, '/inspect' => Controllers::Inspect, '/health_check' => Controllers::HealthCheck, '/environment' => Controllers::Environment }
Instance Method Summary collapse
-
#call(env) ⇒ Array
Sets up the rack application.
-
#initialize(app = nil) ⇒ void
constructor
Sets up the rack application.
Constructor Details
#initialize(app = nil) ⇒ void
Sets up the rack application.
30 31 32 |
# File 'lib/heartcheck/app.rb', line 30 def initialize(app = nil) @app = app end |
Instance Method Details
#call(env) ⇒ Array
Sets up the rack application.
43 44 45 46 47 48 49 |
# File 'lib/heartcheck/app.rb', line 43 def call(env) req = Rack::Request.new(env) [200, { 'Content-Type' => 'application/json' }, [dispatch_action(req)]] rescue Heartcheck::Errors::RoutingError [404, { 'Content-Type' => 'application/json' }, ['Not found']] end |