Node JS—What is It? What is Used For? Why Should You Learn It?
I/O refers to input/output. It can be anything ranging from reading/writing local files to making an HTTP request to an API.
I/O takes time and hence blocks other functions.
Consider a scenario where we request a backend database for the details of user1 and user2 and then print them on the screen/console. The response to this request takes time, but both of the user data requests can be carried out independently and at the same time.
In the blocking method, user2's data request is not initiated until user1's data is printed to the screen.
That’s where the non-blocking part comes in.
On the other hand, using a non-blocking request, you can initiate a data request for user2 without waiting for the response to the request for user1. You can initiate both requests in parallel.
This non-blocking I/O eliminates the need for multi-threading since the server can handle multiple requests at the same time.
Advantages of Node.js
- Node.js is an open-source framework under MIT license. (MIT license is a free software license originating at the Massachusetts Institute of Technology (MIT).)
- Lightweight framework that includes bare minimum modules. Other modules can be included as per the need of an application.
- Asynchronous by default. So it performs faster than other frameworks.
- Cross-platform framework that runs on Windows, MAC or Linux
Have A Look Creative News
Does programming sound like a distressing activity for you? Individuals trust it shouldn't be since it appears to be all coders do is sit befor...