Created
September 1, 2011 05:48
-
-
Save nobuh/1185539 to your computer and use it in GitHub Desktop.
Naked HTTP. a sample of http server in node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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