mirror of
				https://github.com/sinatra/sinatra
				synced 2023-03-27 23:18:01 -04:00 
			
		
		
		
	refactoring
This commit is contained in:
		
							parent
							
								
									8cc45b6a1a
								
							
						
					
					
						commit
						939f30ace0
					
				
					 4 changed files with 38 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -1,13 +1,13 @@
 | 
			
		|||
$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
 | 
			
		||||
# after_attend :log_fun_stuff
 | 
			
		||||
# 
 | 
			
		||||
# helpers do
 | 
			
		||||
#   def log_fun_stuff
 | 
			
		||||
#     logger.debug "THIS IS COOL!"
 | 
			
		||||
#   end
 | 
			
		||||
# end
 | 
			
		||||
 | 
			
		||||
get '/' do
 | 
			
		||||
  body <<-HTML
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +15,10 @@ get '/' do
 | 
			
		|||
  HTML
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
get '/hello' do
 | 
			
		||||
  "Hello World!"
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
post '/' do
 | 
			
		||||
  body "You entered #{params[:name]}"
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue