This extension is part of the Sinatra::Contrib project. Run gem install sinatra-contrib to have it available.
Create multiple routes with one statement.
Use this extension to create a handler for multiple routes:
get '/foo', '/bar' do # ... end
Or for multiple verbs:
route :get, :post, '/' do # ... end
Or even for custom verbs:
route 'LIST', '/' do # ... end
To use the extension in a classic application all you need to do is require it:
require "sinatra" require "sinatra/multi_route" # Your classic application code goes here...
To use the extension in a modular application you need to require it, and then, tell the application you will use it:
require "sinatra/base" require "sinatra/multi_route" class MyApp < Sinatra::Base register Sinatra::MultiRoute # The rest of your modular application code goes here... end