Created
          September 16, 2010 16:55 
        
      - 
      
- 
        Save sixtus/582747 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
    
  
  
    
  | var http = require('http'); | |
| var client = http.createClient(81, 'localhost'); | |
| var request = client.request('GET', '/'); | |
| request.end(); | |
| request.on('response', function (response) { | |
| console.log('STATUS: ' + response.statusCode); | |
| console.log('HEADERS: ' + JSON.stringify(response.headers)); | |
| response.setEncoding('utf8'); | |
| response.on('data', function (chunk) { | |
| console.log('BODY: ' + chunk); | |
| }); | |
| }); | |
| request.on('error', function(error) { | |
| console.log("error"); | |
| console.dir(error); | |
| }); | |
| console.log("all async baby"); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
$ node -v
v0.2.1
node trigger.js
all async baby
node.js:63
throw e;
^
Error: ECONNREFUSED, Connection refused
at IOWatcher.callback (net:854:22)
at node.js:769:9