Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Node.js  Design Patterns

You're reading from   Node.js Design Patterns Master best practices to build modular and scalable server-side web applications

Arrow left icon
Product type Paperback
Published in Jul 2016
Publisher Packt
ISBN-13 9781785885587
Length 526 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Luciano Mammino Luciano Mammino
Author Profile Icon Luciano Mammino
Luciano Mammino
 Purra Purra
Author Profile Icon Purra
Purra
Mario Casciaro Mario Casciaro
Author Profile Icon Mario Casciaro
Mario Casciaro
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Node.js Design Patterns - Second Edition
Credits
About the Authors
Acknowledgments
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. Welcome to the Node.js Platform FREE CHAPTER 2. Node.js Essential Patterns 3. Asynchronous Control Flow Patterns with Callbacks 4. Asynchronous Control Flow Patterns with ES2015 and Beyond 5. Coding with Streams 6. Design Patterns 7. Wiring Modules 8. Universal JavaScript for Web Applications 9. Advanced Asynchronous Recipes 10. Scalability and Architectural Patterns 11. Messaging and Integration Patterns

Comparison


At this point, we should have a better understanding of the options we have to tame the asynchronous nature of JavaScript. Each one of the solutions presented has its own pros and cons. Let's summarize them in the following table:

Solutions

Pros

Cons

Plain JavaScript

  • Does not require any additional libraries or technology

  • Offers the best performance

  • Provides the best level of compatibility with third-party libraries

  • Allows the creation of ad hoc and more advanced algorithms

Might require extra code and relatively complex algorithms

Async (library)

  • Simplifies the most common control flow patterns

  • Is still a callback-based solution

  • Good performance

  • Introduces an external dependency

  • Might still not be enough for advanced flows

Promises

  • Greatly simplifies the most common control flow patterns

  • Robust error handling

  • Part of the ES2015 specification

  • Guarantees deferred invocation of onFulfilled and onRejected

  • Requires promisify callback-based APIs

  • Introduces a...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images