Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
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
Mario Casciaro Mario Casciaro
Author Profile Icon Mario Casciaro
Mario Casciaro
Joel Purra Joel Purra
Author Profile Icon Joel Purra
Joel Purra
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Welcome to the Node.js Platform 2. Node.js Essential Patterns FREE CHAPTER 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

Chapter 2. Node.js Essential Patterns

Embracing the asynchronous nature of Node.js is not trivial at all, especially if coming from a language such as PHP where it is not usual to deal with asynchronous code.

In synchronous programming, we are used to the concept of imagining code as a series of consecutive computing steps defined to solve a specific problem. Every operation is blocking, which means that only when an operation is completed is it possible to execute the next one. This approach makes the code easy to understand and debug.

Instead, in asynchronous programming, some operations, such as reading a file or performing a network request, can be executed as an operation in the background. When an asynchronous operation is invoked, the next one is executed immediately, even if the previous operation has not finished yet. The operations pending in the background can complete at any time, and the whole application should be programmed to react in the proper way when an asynchronous...

You have been reading a chapter from
Node.js Design Patterns - Second Edition
Published in: Jul 2016
Publisher: Packt
ISBN-13: 9781785885587
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 €18.99/month. Cancel anytime