Skip to content

Instantly share code, notes, and snippets.

@adamluzsi
Created April 5, 2016 16:16
Show Gist options
  • Save adamluzsi/c6871406bf4c45a04f39fa8e8637a70b to your computer and use it in GitHub Desktop.
Save adamluzsi/c6871406bf4c45a04f39fa8e8637a70b to your computer and use it in GitHub Desktop.
simple_website
require 'rack/app'
require 'rack/app/front_end'
class App < Rack::App
apply_extensions :front_end
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