Created
          July 5, 2012 20:13 
        
      - 
      
 - 
        
Save lucassmagal/3056172 to your computer and use it in GitHub Desktop.  
    Sinatra app example
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require 'sinatra' | |
| require 'haml' | |
| # run this app calling "ruby app.rb" | |
| get '/' do | |
| haml :index | |
| end | |
| get '/:name' do |n| | |
| @name = n | |
| haml :index | |
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | source :rubygems | |
| gem 'sinatra' | |
| gem 'haml' | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # put this in /views | |
| %h1= "Hello World #{@name}!" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # put this in /views | |
| %html | |
| %head | |
| %title Hello World | |
| %body | |
| =yield | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment