What is Node.js ?
Why Node.js ?
- Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
- Blocking I/O- In the blocking method, user2 data request is not initiated until user1 data is printed to the screen.
- Non-blocking I/O-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.
- Node.js is awesome for building APIs.
- Node.js is portable. It is available on Microsoft Windows, macOS, Linux, Solaris, FreeBSD, OpenBSD, WebOS, and NonStop OS.
- Node.js applications never buffer any data. These applications simply output the data in chunks.
- Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world. These are libraries built by the awesome community which will solve most of your generic problems.
Why Node.Js is Better than Others
- Node.js is equally suitable for small as well as large-scale apps.
- In the case of Node.js, it is not necessary to have full understanding of the framework.
- Node.Js is comparatively more scalable.
- It is used widely in many countries and ahead comparatively.
Limitations of Node.js
- Asynchronous programming could be difficult to work with but easy once understood.
- Synchronous- Say we have 2 lines of codes Line1 followed by Line2. Synchronous means Line-2 can not start running until the Line-1 has finished executing.
- Asynchronous-Again say we have two lines of code Line1 followed by Line2. Line-1 is a time-consuming instruction. So Line-1 starts executing its instruction in the background, allowing Line-2 to start executing without having to wait for Line-1 to finish.
- Not great with CPU intensive apps due to its single thread but this single thread is advantageous in other cases.
- Callbacks result in tons of nested callbacks.
That’s all I have and thanks a lot for reading. Please let me know if any corrections/suggestions. Please do share and comments if you like the post. Thanks in advance… 😉
Thanks Yash Kesharvani for helping us to grow day by day. He is expert in the backend services and loves to play around node.js.