Saturday, October 13, 2012

The Node Beginner Book » A comprehensive Node.js tutorial

The Node Beginner Book » A comprehensive Node.js tutorial: "database.query("SELECT * FROM hugetable", function(rows) {
var result = rows;
});
console.log("Hello World");
Here, instead of expecting database.query() to directly return a result to us, we pass it a second parameter, an anonymous function.

In its previous form, our code was synchronous: first do the database query, and only when this is done, then write to the console."

'via Blog this'