Node as a Webserver
Video Course on Real-Time HTML5 with Node.jsthe http module will handle the requests
var http = require("http");
var http_serv = http.createServer(handleHTTP);
function handleHTTP(req, res){
// do stuff with req and res
// res.end("Hello World");
}
var host = localhost
var port = 8006;
var http = require("http");
var http_serv = http.createServer(handleHTTP).listen(port, host);
tha'ts the simplest thing you need to wire up a serverthen the node becomes a long running process
npm install -g forever
one of the dozen process monitor utilities - if the process dies it restarts
talks about the IGN presents Museum of Mario sitehe made executive decision to run it on nodejs
(source code of the site HTML5Hub/museum-of-mario)
he deployed with the forever script and lived through 4 million requests
it was a single node process
even the load balancers have crashed but not node