On Apr 8, 10:57 pm, Matthew Hazlett <hazl...@gmail.com> wrote:
> It works but its still calllback hell :-(  The db connection gets reused
> tho.

FWIW I do two things in my apps when it comes to deeply nested
callbacks:

1. Pull out some or most of the anonymous functions/callbacks, change
them to named functions, place them outside of the current function
scope (I usually put them in the global/module-level scope), and use
those named functions instead.

2. Use async.js for anything that can't be easily handled/abstracted
by #1: `npm install async` or: https://github.com/caolan/async. It
doesn't use fibers, coroutines, threads, etc, just plain helper
functions to perform asynchronous tasks in a more organized fashion.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to