Created
May 16, 2014 07:46
-
-
Save hokaccha/5892d129a504aa429c01 to your computer and use it in GitHub Desktop.
This file contains 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'); | |
http.createServer(function(req, res) { | |
var data = ''; | |
req.on('data', function(chunk) { | |
data += chunk; | |
}); | |
req.on('end', function() { | |
console.log(data); //=> 'foo!' | |
res.end('ok'); | |
process.exit(); | |
}); | |
}).listen(3030, function() { | |
var req = http.request({ | |
method: 'DELETE', | |
port: 3030, | |
hostname: 'localhost' | |
}); | |
req.write('foo!'); | |
req.end(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment