Class: Async::Background::Web::Router

Inherits:
Object
  • Object
show all
Defined in:
lib/async/background/web/router.rb

Constant Summary collapse

GET_ROUTES =
{
  '/' => :index,
  '/assets/app.js' => :javascript,
  '/assets/app.css' => :stylesheet,
  '/api/overview' => :overview,
  '/api/executing' => :executing,
  '/api/claimed' => :claimed,
  '/api/done' => :done,
  '/api/failed' => :failed,
  '/api/pending' => :pending,
  '/api/metrics' => :metrics,
  '/api/config' => :config,
  '/api/stream' => :stream
}.freeze
ALLOWED_METHODS =
%w[GET HEAD].freeze

Instance Method Summary collapse

Instance Method Details

#match(env) ⇒ Object



24
25
26
27
28
# File 'lib/async/background/web/router.rb', line 24

def match(env)
  return unless ALLOWED_METHODS.include?(env['REQUEST_METHOD'])

  GET_ROUTES[env['PATH_INFO'] || '/']
end