1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00
sinatra/examples/hello/test.rb

33 lines
481 B
Ruby
Raw Normal View History

2007-09-09 00:46:38 +00:00
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib/'
2007-09-08 23:51:24 +00:00
require 'sinatra'
2007-09-09 22:21:21 +00:00
after_attend :log_fun_stuff
helpers do
def log_fun_stuff
logger.debug "THIS IS COOL!"
end
end
2007-09-09 00:46:38 +00:00
2007-09-08 23:51:24 +00:00
get '/' do
body <<-HTML
<form method="POST"><input type="text" name="name"/><input type="submit"></form>
HTML
end
2007-09-09 22:21:18 +00:00
get '/hello' do
"Hello World!"
end
2007-09-08 23:51:24 +00:00
post '/' do
body "You entered #{params[:name]}"
end
get '/erb' do
erb :index
end
get '/test' do
erb "Hello <%= params[:name] %>"
end