WebFund 2016W Lecture 7

From Soma-notes
Revision as of 15:53, 30 January 2016 by Soma (talk | contribs)

Video

The video for the lecture given on January 28, 2016 is now available.

Notes

In-class Poll

https://pollev.com/anilsomayaji565

Code

var http = require('http');

var request_handler = function(request, response) {

    var body_content;

    console.log("I got a request for: " + request.url);

    response.writeHead(404, {
        "Content-Type": "text/html"
    });

    body_content = "You requested: " + request.url;
    
    response.write("<html>\n<head>\n<title>Hello!</title>\n</head>" +
		   "<body><h1>Hello world!</h1>" +
		   "<p>" + body_content + "</p>" +
		   "<script>alert('where does this print');</script> " +
		   "\n</body>\n</html>\n");

    return response.end();
}

var server = http.createServer(request_handler);

server.listen(8000, "localhost", function() {
    return console.log("Server listening at http://localhost:8000/");
});

console.log("Finished!");