I am fairly new to NodeJS and I'm having a hard time wrapping my head around the asynchronous nature of functions when I really want one call to follow the other in a synchronized way.

Say for instance I am calling web service methods. Every method has a callback function. But what if I want to call 10 of them in a specific sequence? Do I really need to chain / embed all the functions in the first callback? What if the second time the chain is slightly different?

Are there any elegant patterns to deal with situations where you actually do want things to be synchronous?

Or should I really let go of this kind of programming get used to a different way of thinking? If that's true maybe someone can point me to a clean example of a longer chain of functions using callbacks...

  • 10 request in a specific sequence. Are they independent of eachother?
    – Jonas
    Dec 12, 2011 at 21:35
  • 1
    And note: Linked in a chain doesn't mean it's not async unless everything is linked in that chain. Feb 22, 2013 at 22:02

1 Answer 1


People usually use Step or Async for that. Check them out, there are a lot of nice tutorials about them, you'll see they come "to the resque:"


Also check these 2 answers:


  • Glad I could help!
    – alessioalex
    Dec 13, 2011 at 15:23
  • 1
    I sure appreciate these link you've provided! Feb 25, 2015 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.