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
  # ...

Or for multiple verbs:

route :get, :post, '/' do
  # ...

Or even for custom verbs:

route 'LIST', '/' do
  # ...

Classic Application

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...

Modular Application

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...
Fork me on GitHub