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

hello world

This commit is contained in:
blake.mizerany@gmail.com 2007-09-25 17:42:17 +00:00
parent 05d0c82e35
commit 89acb2fcdc
3 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,9 @@
GET /erb | Status: 200 | Params: {:format=>"html", :name=>"blake"}
GET /erb | Status: 200 | Params: {:format=>"html"}
GET /erb2 | Status: 200 | Params: {:format=>"html"}
GET /erb2 | Status: 200 | Params: {:format=>"html"}
GET /erb2 | Status: 200 | Params: {:format=>"html", :name=>"blake"}
GET /erb2 | Status: 200 | Params: {:format=>"html", :name=>"blake"}
GET /erb2 | Status: 200 | Params: {:format=>"html", :name=>"blake"}
GET /erb2 | Status: 200 | Params: {:format=>"html", :name=>"blake"}
GET /erb | Status: 200 | Params: {:format=>"html", :name=>"blake"}

20
examples/hello/hello.rb Normal file
View file

@ -0,0 +1,20 @@
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
require 'sinatra'
get '/' do
"Hello World!"
end
get '/erb.xml' do
header 'Content-Type' => 'application/xml'
'<this_is_xml/>'
end
get '/erb' do
erb :hello
end
get '/erb2' do
erb 'Hello <%= params[:name].capitalize || "World" %> 2!'
end

View file

@ -0,0 +1 @@
Hello <%= params[:name].capitalize || 'World' %>!