Skip to content

Instantly share code, notes, and snippets.

@vangberg
Created July 30, 2009 16:04
Show Gist options
  • Save vangberg/158754 to your computer and use it in GitHub Desktop.
Save vangberg/158754 to your computer and use it in GitHub Desktop.
# This is our base controller, much like ApplicationController in Rails
class App < Sinatra::Base
# Default settings that should be shared by all controllers
set :foo, :bar
def shared_helper
# this will be available for everything
end
end
class Users < App
get '/' do
...
end
post '/' do
...
end
end
class Comments < App
get '/' do
...
end
post '/' do
...
end
end
require 'app'
map('/users') { run Users }
map('/comments') { run Comments }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment