I have been hearing about Node.js for quite some time and whenever they talk about it, my mind is filled with a lot of different questions as to what it exactly is, what it does, it’s limitations and whether it will remain useful in the future.
Node.js is a Javascript runtime environment which means that its environment has everything that is required to run app programs written in javascript, I think of it as an extension to to make it more worthy as new technologies are being built eventually. A few years ago all that javascript could do was making websites interactive but with Node.js it can do much as a standalone application.
Sticking to the point, let us talk about event loops in Node.js. This is what makes Node.js perform non-blocking Input/Output operations. Usually, when Node.js starts, it first initialises the event loop, processes the input script and then begins processing the event loop.
Node.js is asynchronous and circular with event loop at its core looping at a constant frequency and with high-speed processing callbacks during each phase of that loop. I personally think that when a Node app seems to feed out steps that are out of order it’s probably the developer that didn’t clearly understand the event loop and its phases. Someone could wonder if one can write Node apps without solid prior knowledge to event loops, yes you can but you would write far better applications with a good understanding of event loops in mind.
As we said earlier every Node.js event loop application runs through phases. When I was writing this series I found an overview from the Node team(nodejs.org) and decided to take it a little further as it highlights the most important phases and their uses in event looping.
Top comments (0)