Skip to content

Instantly share code, notes, and snippets.

@gcphost
Created June 29, 2015 03:10
Show Gist options
  • Save gcphost/2a942b57fa1d728fc04a to your computer and use it in GitHub Desktop.
Save gcphost/2a942b57fa1d728fc04a to your computer and use it in GitHub Desktop.
Sinatra MVC Style Module
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