repo.or.cz
/
sinatra.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
Turn sessions on or off
[sinatra.git]
/
examples
/
hello
/
hello.rb
blob
ffe5ceed2a5034f288892a5b2efc1375998d1c8b
1
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
2
require 'sinatra'
3
4
production do
5
sessions :off
6
end
7
8
get '/' do
9
"Hello World!"
10
end
11
12
get '/erb.xml' do
13
header 'Content-Type' => 'application/xml'
14
'<this_is_xml/>'
15
end
16
17
get '/erb' do
18
erb :hello
19
end
20
21
get '/erb2' do
22
erb 'Hello <%= params[:name].capitalize || "World" %> 2!'
23
end
24
25
# Custom 404
26
27
get 404 do
28
'Custom 404!!!!'
29
end
30