Class: RackStaticApp::Application

Inherits:
Vienna::Application
  • Object
show all
Defined in:
lib/rackstaticapp.rb

Overview

RackStaticApp::Application serves all files under the given root directory using RackStaticApp::Static. If a file/path doen’t exist, RackStaticApp::NotFound is run, which always returns a status of 404 and the contents of 404.html or ‘’Not Found’‘ if one does not exist.

Examples

run RackStaticApp::Application.new('_site')

run RackStaticApp::Application.new # The root defaults to 'public'

Instance Method Summary collapse

Constructor Details

#initialize(root = 'public') ⇒ Application

Returns a new instance of Application.



91
92
93
94
95
96
# File 'lib/rackstaticapp.rb', line 91

def initialize(root = 'public')
  @app = Rack::Builder.new do
    use Static, root
    run NotFound.new("#{root}/404.html")
  end
end