Node as a Webserver

In notebook:
FrontEndMasters Real-Time Web with Node.js
Created at:
2015-10-13
Updated:
2015-10-14
Tags:
JavaScript Node JS backend
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 server

then 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 site
he 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