7

Event-Driven Architecture

Events are one of the most powerful ways to use Node.js. Node.js was designed from the ground up to build event-driven modules. Many core libraries offer an events interface that can be used and extended easily. Also, Node.js provides a powerful events library that can be used to build event-driven modules.

In this chapter, we delve into events in Node.js. We will learn how to use events from the core libraries, from event listener registration to event emission, and handling multiple listeners for the same event.

We will build our first HTTP server using events, and we will discuss the organization of event listeners and the cleanup.

To sum up, here are the main topics that we will explore in this chapter:

  • Introducing ...

Get Node.js for Beginners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.