2

Which is the best practice to write nodejs code.

There are so many callback in my current code and reduced the readability.

Any suggestion?

1
  • This question is more appropriate for a discussion forum than StackOverflow. "This question is not a good fit to our Q&A format. We expect answers to generally involve facts, references, or specific expertise; this question will likely solicit opinion, debate, arguments, polling, or extended discussion." Commented Aug 15, 2011 at 1:55

2 Answers 2

1

Callback: Use a callback if you just want to execute some code at a certain time and you don't need to emit success or failure.

EventEmitter: Use this if your object emits lots of types of events.

Sign up to request clarification or add additional context in comments.

Comments

0

Try to look at some flow control libraries and articles in answer to this question: Async programming paradigm with nodejs and redis-node.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.