mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
hello world
This commit is contained in:
parent
05d0c82e35
commit
89acb2fcdc
3 changed files with 30 additions and 0 deletions
9
examples/hello/development.log
Normal file
9
examples/hello/development.log
Normal 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
20
examples/hello/hello.rb
Normal 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
|
||||
|
1
examples/hello/views/hello.erb
Normal file
1
examples/hello/views/hello.erb
Normal file
|
@ -0,0 +1 @@
|
|||
Hello <%= params[:name].capitalize || 'World' %>!
|
Loading…
Reference in a new issue