Skip to content

Instantly share code, notes, and snippets.

@terinjokes
Created March 17, 2013 06:32
Show Gist options
  • Save terinjokes/5180387 to your computer and use it in GitHub Desktop.
Save terinjokes/5180387 to your computer and use it in GitHub Desktop.
var http = require('http');
http.createServer(function(request, response) {
console.log('Request from: '+ request.url);
response.end();
}).listen(1337);
http.request({
host: '127.0.0.1',
port: 1337,
path: '/request1'
}, function(response) {
response.on('end', function() {
console.log('request 1 ended');
});
}).end();
http.request({
host: '127.0.0.1',
port: 1337,
path: '/request2'
}, function(response) {
response.on('data', function(){});
response.on('end', function() {
console.log('request 2 ended');
});
}).end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment