sinatra-subroutes

Create Sinatra routes that respond to the subdomain defined, similar to the built in user_agent option. Compiled into a gem from these sources: tannerburson.com/2009/01/extracting-subdomains-in-sinatra.html toms-toolbox.com/2010/04/sinatra-native-subdomain-routing/

Install

  gem install sinatra-subroutes

Usage

require 'sinatra'
require 'sinatra-subroutes'

set :tld_size, 2 # Use this for domains such as example.co.uk, default is 1

get '/', :subdomain => /subdomain/ do
  'You're at the root of the "subdomain" subdomain'
end

Contributing to sinatra-subroutes

Copyright © 2010 Daniel Westendorf. See LICENSE.txt for further details.