Last active
          October 25, 2015 06:50 
        
      - 
      
- 
        Save dougluce/05146dc189ec6636a477 to your computer and use it in GitHub Desktop. 
  
    
      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
    
  
  
    
  | if req.params.code | |
| err, result <- dbconn.query QUERY | |
| org = result.rows[0].id | |
| else | |
| org = 1 | |
| ... use org somewhere ... | 
  
    
      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
    
  
  
    
  | checkcode = (req, cb) -> | |
| if req.params.code | |
| err, result <- dbconn.query QUERY | |
| cb result.rows[0].id | |
| else | |
| cb 1 | |
| mainfunc = req -> | |
| org <- checkcode | |
| ... use org somewhere ... | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
you need to handle the error too: