Skip to content

Instantly share code, notes, and snippets.

@hokaccha
Created May 16, 2014 07:46
Show Gist options
  • Save hokaccha/5892d129a504aa429c01 to your computer and use it in GitHub Desktop.
Save hokaccha/5892d129a504aa429c01 to your computer and use it in GitHub Desktop.
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