Skip to content

Instantly share code, notes, and snippets.

@thejh
Created November 4, 2011 16:59
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 thejh/1339846 to your computer and use it in GitHub Desktop.
Save thejh/1339846 to your computer and use it in GitHub Desktop.
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, "0.0.0.0", function() {
console.log("listening!");
http.request({host: '127.0.0.1', port: 1337, path: '/'}, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
process.exit();
}).end();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment