Class: Goliath::Rack::Heartbeat

Inherits:
Object
  • Object
show all
Defined in:
lib/goliath/rack/heartbeat.rb

Overview

A heartbeat mechanism for the server. This will add a /status endpoint that returns status 200 and content OK when executed.

Examples:

use Goliath::Rack::Heartbeat

Instance Method Summary (collapse)

Constructor Details

- (Heartbeat) initialize(app)

A new instance of Heartbeat



10
11
12
# File 'lib/goliath/rack/heartbeat.rb', line 10

def initialize(app)
  @app = app
end

Instance Method Details

- (Object) call(env)



14
15
16
17
18
19
20
# File 'lib/goliath/rack/heartbeat.rb', line 14

def call(env)
  if env['PATH_INFO'] == '/status'
    [200, {}, 'OK']
  else
    @app.call(env)
  end
end