Class: Fronton::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/fronton/server.rb

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

Rack entrypoint



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fronton/server.rb', line 6

def call(env)
  if page = requested_page(env) # rubocop:disable Lint/AssignmentInCondition

    if page.exist?
      render_page(page)
    else
      error_404
    end
  else
    fallback = config.fallback_page

    if fallback
      render_page(fallback)
    else
      error_404
    end
  end
end