Skip to content

Instantly share code, notes, and snippets.

@nobuh
Created September 1, 2011 05:48
Show Gist options
  • Save nobuh/1185539 to your computer and use it in GitHub Desktop.
Save nobuh/1185539 to your computer and use it in GitHub Desktop.
Naked HTTP. a sample of http server in node.js
var http = require("http");
var port;
if (process.argv.length < 3) {
port = 8192;
} else {
port = process.argv[2];
}
http.createServer(function(requset, response) {
response.writeHead(200, {"Content-Type" : "text/plain"});
response.write("Naked HTTP:\n");
response.end();
}).listen(port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment