Get started with node.js - xuanz1993/NodeJS GitHub Wiki

Node's event loop - non-blocking I/O

  1. events can be externally generated (http, tcp request), can be internally generated (timers)
  2. node does not pause and wait for any of these requests to complete, followed non-blocking & event-driven approach

Re-organize our code with call-back function as a parameter -- writing asynchronous code using call-back

example snap of code:

getStuff(inputParam, function(error, results){
   //if error is undefined
   //doing something with results
});
  1. Beware of the "Christmas tree" effect. The smart use of named functions,as well as modules, event emitters and streams. These are tools which make "Node" applications are no difficult to build and maintain.