mirror of
				https://github.com/sinatra/sinatra
				synced 2023-03-27 23:18:01 -04:00 
			
		
		
		
	* silence warnings or reload
* simple responder * update examples
This commit is contained in:
		
							parent
							
								
									b215850cbd
								
							
						
					
					
						commit
						49da7fc4c7
					
				
					 8 changed files with 67 additions and 42 deletions
				
			
		| 
						 | 
				
			
			@ -2,16 +2,6 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib/'
 | 
			
		|||
require 'sinatra'
 | 
			
		||||
 | 
			
		||||
get '/' do
 | 
			
		||||
  html {p "here, b"}
 | 
			
		||||
  format.html {p "here, b"}
 | 
			
		||||
  p "hi"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
get 'index' do
 | 
			
		||||
  html {body "in here!"}
 | 
			
		||||
  body do 
 | 
			
		||||
    "pancakes"
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
get 'favicon' do
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,32 +1,6 @@
 | 
			
		|||
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib/'
 | 
			
		||||
require 'sinatra'
 | 
			
		||||
 | 
			
		||||
after_attend :log_fun_stuff
 | 
			
		||||
 | 
			
		||||
helpers do
 | 
			
		||||
  def log_fun_stuff
 | 
			
		||||
    logger.debug "THIS IS COOL!"
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
get '/' do
 | 
			
		||||
  body <<-HTML
 | 
			
		||||
  <form method="POST"><input type="text" name="name"/><input type="submit"></form>
 | 
			
		||||
  HTML
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
get '/hello' do
 | 
			
		||||
  "Hello World!"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
post '/' do
 | 
			
		||||
  body "You entered #{params[:name]}"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
get '/erb' do
 | 
			
		||||
  erb :index
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
get '/test' do
 | 
			
		||||
  erb "Hello <%= params[:name] %>"
 | 
			
		||||
  format.xml { body 'blake in xml' }
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue