How Node Applications Work

Node.js couples JavaScript with an event loop for quickly dispatching operations when events occur. Many JavaScript environments use an event loop, but it is a core feature of Node.js.

Node’s philosophy is to give you low-level access to the event loop and to system resources. Or, in the words of core committer Felix Geisendörfer, in Node “everything runs in parallel except your code.”[4]

If this seems a little backwards to you, don’t worry. The following figure shows how the event loop works.

images/eventloop.png
Figure 3. The Node.js event loop

As long as there’s something left to do, Node’s event loop will keep spinning. Whenever ...

Get Node.js the Right Way 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.