Get a cookie into your mouth, get finished this read before the cookie ends up!
So, You want to know the architecture behind Node js, right?
Just take a tour under this section!
What is Node js?
We all know Node js is-
a server-side framework.
Open source runtime to communicate with the server.
Created by Ryan Dhal in 2009, it has evolved since creation to allow developers to build almost anything!
These questions may be puzzled you many times, isn’t it?
When we are going to elaborate on the architecture behind Node js, we have to move with the dependencies it has.
But only V8 is not enough for a server-side framework to be worked. There has to be something that can connect and make deals with the computer operating system. And here comes the mighty Libuv to play this role!
So, what is Libuv?
Libuv is an open-source library with a strong focus on asynchronous IO and input-output duo! It gives node access to the underlying computer operating system, file system, networking, and more.
But not the end. Event Looping and Thread pool are two extremely important features of node js. You got it! Libuv implements them as well.
Libuv create a layer to get access to a computer operating system, file system, networking, and many more
What Event loop does?
Event loop is responsible for handling easy tasks like executing Callbacks and Network IO.
And what about the Thread pool?
Well, Thread Pool is for more heavy work like file access or compression.
How our life is easier than before? Just think, you don’t have to do all these pieces of stuff with C++ and get messed!
So what other libraries that I mentioned by saying ‘all these libraries’?
Actually, only V8 engine and Libuv are not enough for Node js to completely work!
It has to parse Http, some DNS request stuff, Kleptography. and compression!
These 4 C++ Libraries help Node to do these kinds of stuff.
Http-parser for Parsing Http.
C-ares or something like that for some DNS request stuff
OpenSSL for Kleptography.
Zlib for compression.
To make this read no longer than 5 minutes, I have to ring the bell here and not going to discuss all these libraries and their tasks. It is enough for you to get the main idea of Node architecture! After having all these libraries nicely fit together, we end up with Node JS ready to be used on the server-side. Have a great future on node js, folks!