Most of Node’s objects — like HTTP requests, responses, and streams — implement the
EventEmitter module so they can provide a way to emit and listen to events.
The simplest form of the event-driven nature is the callback style of some of the popular Node.js functions — for example,
fs.readFile. In this analogy, the event will be fired once (when Node is ready to call the callback) and the callback acts as the event handler.
Let’s explore this basic form first.
... read the whole story at medium.freecodecamp.com.