Module Sinatra::MultiRoute
In: lib/sinatra/multi_route.rb

Sinatra::MultiRoute

Create multiple routes with one statement.

Usage

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 for multiple verbs and multiple routes:

  route :get, :post, ['/foo', '/bar'] do
    # ...
  end

Or even for custom verbs:

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

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

Methods

delete   get   head   options   patch   post   put   route  

Public Instance methods

[Validate]