Module: Staticky::ServerPlugin

Defined in:
lib/staticky/server_plugin.rb

Defined Under Namespace

Modules: RequestMethods

Class Method Summary collapse

Class Method Details

.load_dependencies(app) ⇒ Object



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

def self.load_dependencies(app)
  app.plugin :common_logger, Staticky.server_logger, method: :debug
  app.plugin :render, engine: "html"
  app.plugin :public
  app.plugin :exception_page

  app.plugin :not_found do
    raise Staticky::Server::NotFound if Staticky.env.test?

    Staticky.build_path.join("404.html").read
  end

  app.plugin :error_handler do |error|
    raise error if Staticky.env.test?
    next exception_page(error) if Staticky.env.development?

    Staticky.build_path.join("500.html").read
  end
end