Name: Anonymous 2010-02-09 16:16
Write a small HTTP server that upon receiving a GET request, responds with Sussman. Other /prog/ related responses may be added at your discretion.
#!/usr/bin/node
require("http").createServer(function (request, response) {
response.sendHeader(200, {"Content-Type": "text/plain"});
response.sendBody("Sussman");
response.finish();
}).listen(8080);
#!/usr/bin/node
var sys = require('sys');
require("http").createServer(function (request, response) {
if (request.method == "GET") {
response.sendHeader(200, {"Content-Type": "text/html"});
response.sendBody("<html><body><b>Sussman</b></body></html>");
} else {
response.sendHeader(405, {"Content-Type": "text/plain"});
response.sendBody("YOU MENA HASKAL?");
}
response.finish();
}).listen(80);