Summary

Throughout this chapter, we analyzed some alternative approaches of dealing with asynchronous control flows considering promises, generators, and the upcoming async await syntax.

We learned how to use these approaches to write asynchronous code that is more concise, cleaner and easier to reason about. We discussed some of the most important advantages and drawbacks of these approaches and realized that even if they are very useful they need some time to be mastered. That's why they should not be seen as a complete replacement of callbacks which are still very useful in many scenarios. As a developer, you should now be able to decide which solution best suits the problem you are facing. If you are building a public library that performs asynchronous operations, you should provide an interface that is easy to use, even for developers who only want to use callbacks.

In the next chapter we will explore another fascinating topic relevant to asynchronous code execution and which is another fundamental building block in the whole Node.js ecosystem: streams.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.106.233