Skip to content

Instantly share code, notes, and snippets.

@creationix
Created July 26, 2012 00:49
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 creationix/f31c9fc51eba9703049e to your computer and use it in GitHub Desktop.
Save creationix/f31c9fc51eba9703049e to your computer and use it in GitHub Desktop.
var http = require('http');
var body = new Buffer("Hello World\n");
var headers = {
"Content-Type": "text/plain",
"Content-Length": body.length//Buffer.byteLength(body)
};
var server = http.createServer(function (req, res) {
res.writeHead(200, headers);
res.end(body);
});
server.listen(8080, function () {
var port = server.address().port;
console.log("bench server listening on http://127.0.0.1:%s/", port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment