Created
March 25, 2016 14:12
-
-
Save thilonel/b11f4e938af4a528b20c to your computer and use it in GitHub Desktop.
simple_website
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack/app' | |
require 'rack/app/front_end' | |
class App < Rack::App | |
extend Rack::App::FrontEnd | |
helpers do | |
def method_that_can_be_used_in_template | |
'hello world!' | |
end | |
end | |
# use ./app/layout.html.erb as layout, this is optionable | |
layout 'layout.html.erb' | |
# at '/' the endpoint will serve (render) | |
# the ./app/index.html content as response body and wrap around with layout if layout is given | |
get '/' do | |
render 'index.html' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment