Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 23 lines (19 sloc) 0.538 kB
d2385e1 @everythingbehind Give an example of how to use this extension when using Sinatra modul…
everythingbehind authored
1 require 'sinatra/base'
2 require 'sinatra/subdomain'
3
4 # This is an example of a classic application that uses sinatra-subdomain.
5 # You'll need a config.ru as follows:
6 # require 'example_modular_app'
7 # run Hello
8 # Start it using `shotgun -I lib example_modular_app.rb`. Then visit http://smackaho.st:9393 and
9 # http://foo.smackaho.st:9393 to use the application.
10
11 class Hello < Sinatra::Base
12 register Sinatra::Subdomain
13
14 subdomain :foo do |sub|
15 get '/' do
16 "You are on: #{sub}"
17 end
18 end
19
20 get '/' do
21 "Home!"
22 end
23 end
Something went wrong with that request. Please try again.