Skip to content

Instantly share code, notes, and snippets.

@stevenklise
Created December 4, 2011 20:08
Show Gist options
  • Save stevenklise/1431139 to your computer and use it in GitHub Desktop.
Save stevenklise/1431139 to your computer and use it in GitHub Desktop.
Mapping multiple apps with Rack
require 'rubygems'
require 'sinatra'
require './index'
run Rack::URLMap.new("/" => CoolApp.new, "/ohnice" => BetterApp.new)
class CoolApp < Sinatra::Base
get '/' do
"Welcome to the internet."
end
end
class BetterApp < Sinatra::Base
get '/' do
"The time is #{Time.now}."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment