Skip to content

Instantly share code, notes, and snippets.

@thilonel
Created March 25, 2016 14:12
Show Gist options
  • Save thilonel/b11f4e938af4a528b20c to your computer and use it in GitHub Desktop.
Save thilonel/b11f4e938af4a528b20c to your computer and use it in GitHub Desktop.
simple_website
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