Events

Emit an event and send an email inside an event listener.

We'll cover the following

Node.js supports concurrency by using events and async function calls. Events are actions that trigger other actions. We can use Event.fire(name, [data]) to fire an event with optional data and Event.on(name, callback) to bind one or more listeners to an event.

For a comprehensive list of the available methods, refer to the official documentation.

Sending an email

Suppose that we want to fire an event every time a user visits the /send_email_with_events route and send an email inside the event listener.

Get hands-on with 1200+ tech skills courses.