require 'sinatra/base' require 'sinatra_more' require 'haml' class RoutingDemo < Sinatra::Base register Sinatra::RoutingPlugin configure do set :root, File.dirname(__FILE__) end map(:admin, :show).to("/admin/:id/show") map :admin do |namespace| namespace.map(:update).to("/admin/:id/update/:name") namespace.map(:destroy).to("/admin/:id/destroy") end map(:account).to("/the/accounts/:name/path/:id/end") map(:accounts).to("/the/accounts/index/?") namespace :admin do get :show do "
admin show for id #{params[:id]}
" end get :update do "updated admin with id #{params[:id]} and name #{params[:name]}
" end get :destroy do "destroy admin with id #{params[:id]}
" end end get :account do "