Class: S3arch::Dashboard::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/s3arch/dashboard/application.rb

Constant Summary collapse

VIEWS_PATH =
File.expand_path('views', __dir__)

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/s3arch/dashboard/application.rb', line 20

def call(env)
  req = Rack::Request.new(env)
  path = req.path_info.sub(%r{^/}, '')

  case [req.request_method, path]
  when ['GET', ''], %w[GET index]
    index(req)
  when %w[POST rebuild]
    rebuild(req)
  else
    [404, { 'content-type' => 'text/plain' }, ['Not Found']]
  end
end

#routesObject

Dispatcher mount DSL contract — keep in sync with #call dispatch below.



13
14
15
16
17
18
# File 'lib/s3arch/dashboard/application.rb', line 13

def routes
  [
    { method: :get, path: '/' },
    { method: :post, path: '/rebuild' }
  ]
end