Node.js essentials
Node.js is not a separate programming language. It is a runtime over Google’s V8 engine. This simply means that the creator of Node.js just took the V8 engine out of the browser and put it into another runtime. Node.js is a wrapper over the V8 engine and extends it by adding networking, APIs for I/O, and other operations. A key aspect of Node.js is its non-blocking I/O model. This means Node.js can handle multiple requests simultaneously without being blocked by slow operations. The event loop and callback queue become even more important in this context.
Node.js has different dependencies under the hood, but the most interesting one for us to discuss is Libuv. Libuv provides a thread pool for handling certain tasks, with four threads by default, but this can be configured based on the application’s requirements.This is the main magic that provides I/O-based non-blocking operations. It is written in C, and it provides an event-driven asynchronous...