Skip to content

Instantly share code, notes, and snippets.

@jaydonnell
Forked from Musfuut/gist:264941
Created December 28, 2009 21:07
Show Gist options
  • Save jaydonnell/264950 to your computer and use it in GitHub Desktop.
Save jaydonnell/264950 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
configure do
set :data, "none"
end
before do
content_type 'text/plain', :charset => 'utf-8'
request.env['PATH_INFO'].gsub!(/\/$/,'')
end
get '/' do
"Hello World
end
notfound do
"Huh? Where was that again? Hmm, let me look around and get back to you."
end
# This will show the contents of the variable 'data' from above
get '/show' do
"data is set to '#{options.data}'\n"
end
# This sets the contents of the variable 'data' to "one", use /show to display it.
get '/one' do
set :data, "one"
"data is set to '#{options.data}'\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment