Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created June 8, 2011 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnoordhuis/1015649 to your computer and use it in GitHub Desktop.
Save bnoordhuis/1015649 to your computer and use it in GitHub Desktop.
require('http').createServer(function(req, res) {
console.error('Request', req.headers);
req.on('data', function(chunk) {
console.error('Received chunk', chunk, chunk.toString());
});
setTimeout(function() {
var body = "Hello World\n";
res.writeHead(200, {
'Content-Type': 'text/plain',
'Content-Length': '' + body.length
});
res.end(body);
}, 500);
}).listen(8001);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment