Introduction

Get an overview of what we'll learn in this chapter.

In this chapter, we’ll take a problem-solution approach and, like in a cookbook, we’ll present a set of ready-to-use recipes to solve some common Node.js programming problems.

We shouldn’t be surprised by the fact that most of the problems presented in this chapter arise when we try to do things asynchronously. In fact, as we’ve seen repeatedly in the previous chapters, tasks that are trivial in traditional synchronous programming can become more complicated when applied to asynchronous programming. A typical example is trying to use a component that requires an asynchronous initialization step. In this case, we have the inconvenience of delaying any attempt to use the component until the initialization completes. We’ll discuss how to solve this elegantly later.

But this chapter isn’t just about recipes involving asynchronous programming. We’ll also learn the best ways to run CPU-intensive tasks in Node.js.

Here are the recipes we’ll learn in this chapter:

Get hands-on with 1400+ tech skills courses.