2009-11-09 22:09:51 +00:00
|
|
|
require 'sinatra/base'
|
|
|
|
require 'rack'
|
|
|
|
|
2009-11-04 22:32:35 +00:00
|
|
|
class TestApp < Sinatra::Base
|
2009-11-05 16:35:45 +00:00
|
|
|
set :root, File.dirname(__FILE__)
|
|
|
|
set :static, true
|
2009-11-04 22:32:35 +00:00
|
|
|
|
|
|
|
get '/' do
|
|
|
|
'Hello world!'
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/foo' do
|
|
|
|
'Another World'
|
|
|
|
end
|
2009-11-04 23:34:11 +00:00
|
|
|
|
|
|
|
get '/with_html' do
|
|
|
|
erb :with_html
|
|
|
|
end
|
2009-11-04 22:32:35 +00:00
|
|
|
|
2009-11-05 16:35:45 +00:00
|
|
|
get '/with_js' do
|
|
|
|
erb :with_js
|
|
|
|
end
|
|
|
|
|
2009-11-04 22:32:35 +00:00
|
|
|
get '/with_simple_html' do
|
|
|
|
erb :with_simple_html
|
|
|
|
end
|
2009-11-08 00:13:16 +00:00
|
|
|
|
|
|
|
get '/form' do
|
|
|
|
erb :form
|
|
|
|
end
|
|
|
|
|
|
|
|
post '/form' do
|
|
|
|
params[:form].to_yaml
|
|
|
|
end
|
|
|
|
end
|
2009-11-09 22:09:51 +00:00
|
|
|
|
|
|
|
if __FILE__ == $0
|
|
|
|
Rack::Handler::Mongrel.run TestApp, :Port => 8070
|
|
|
|
end
|