Node.js

Blogs on Node.js

module system

Node.js Essentials: Master the “require()” Function by Constructing a Homemade Module Loader

What is a module? A module is a block of code in a file. Modules are the bricks for structuring applications that are too big to efficiently maintain in a single file. They are the main mechanism to enforce information hiding by keeping private all the functions and variables that are not explicitly exported. The […]

Node.js Essentials: Master the “require()” Function by Constructing a Homemade Module Loader Read More »

The Reactor pattern in Node.js

The reactor pattern

The reactor pattern is the heart of Node.js. It is a specialisation of the previously discussed event demultiplexer algorithm. libuv, the non-blocking I/O engine of Node.js, implements the reactor pattern. So, how does it work? Let’s say there’s a single threaded application interested in reading data from a file (an I/O operation). The application kicks

The reactor pattern Read More »