Created
June 29, 2015 03:10
-
-
Save gcphost/2a942b57fa1d728fc04a to your computer and use it in GitHub Desktop.
Sinatra MVC Style Module
This file contains 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
module Sinatra::Hi | |
module Helpers | |
def conf | |
@page_title = 'Hi :D' | |
end | |
end | |
def self.registered(app) | |
app.helpers Helpers | |
get_index = lambda do | |
"Hello World." | |
end | |
get_high = lambda do | |
"Hi :D" | |
end | |
app.namespace "/" do | |
before { | |
conf | |
} | |
get &get_index | |
get '/hi', &get_high | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment