Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Homework

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.

Name: Anonymous 2010-02-10 0:48


#!/usr/bin/node
require("http").createServer(function (request, response) {
  response.sendHeader(200, {"Content-Type": "text/plain"});
  response.sendBody("Sussman");
  response.finish();
}).listen(8080);

Name: Anonymous 2010-02-10 1:02

>>9
now with GET awareness.

#!/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);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List