Re:Fixing the callback spaghetti in node.js
by diamondhead on Thursday September 29, 2011 @04:44AM
(#3051644)
JavaScript itself gives developers enough power to beautify messy async code, already. Below is the rewrite of the first example in that page, with async function composition:
====
/* https://gist.github.com/1250314 */
var db = require('somedatabaseprovider'),
compose.async(getApp, connect, select)({ url:'/price', host:'host', pass:'123' }, function(error, shift){ });====
It's that easy to abstract those messy callbacks using some functional tools.