Skip to content

Instantly share code, notes, and snippets.

@rafbm
Created January 28, 2012 23:29
Show Gist options
  • Save rafbm/1696251 to your computer and use it in GitHub Desktop.
Save rafbm/1696251 to your computer and use it in GitHub Desktop.
Example Sinatra app using the Namespace extension from Sinatra::Contrib
require 'sinatra/base'
require 'sinatra/namespace'
class MyApp < Sinatra::Base
register Sinatra::Namespace
get '/' do
'Home'
end
namespace '/blog' do
get do
'Blog'
end
get '/archives' do
'Blog archives'
end
namespace '/categories' do
get do
'Blog post categories'
end
get '/web' do
'Posts from “web” category'
end
end
end
end
run MyApp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment