Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Look Around You
Jan 19, 2009

Mniot posted:

I understand that Async is popular if you want to do callbacks, though I haven't used it. At my office, we use Bluebird for promises. Then your 10 nested callbacks turn into 10 chained promises.

If it's a straight chain, promises are nice. They often feel easier to wrap your head around, too. On the other hand, whenever I start working with Node's streams (which are quite nice) I need to use callbacks and then I regret the callback/promise mixture that I end up with.

Finally you could look into using fibers, which I think would be the most pleasant way to handle a sequence of DB calls.

I love that there's a major async helper library for a platform whose main advertised feature is that it makes it easy to make asynchronous services out of the box.

Adbot
ADBOT LOVES YOU

  • Locked thread