DEV Community

Cover image for What is NodeJs? Why we use node.JS? What we can do with node.js?
geeksread
geeksread

Posted on • Originally published at geeksread.com

What is NodeJs? Why we use node.JS? What we can do with node.js?

In the previous knowledge bit, we have discussed that how the internet works, the difference between static and dynamic application. We have also seen that what is back-end and how it is different from front-end. Now in this knowledge bit, we will learn what is Nodejs. We will also discuss why we should use NodeJs. We will also discuss the difference between blocking and non-blocking module.

WHAT IS NODEJS?
What is Node.js?

Node.js is not a programming language and it is not a framework, so what exactly it is? It is a JavaScript runtime that is built on the V8 JavaScript engine. It is the same engine that the Google Chrome browser uses and it’s extremely fast and powerful.

WHAT DOES IT IS MEAN BY RUNTIME?
When I say runtime then its mean that node allows JavaScript to run as a standalone process on your machine. The V8 engine which is written in C++ takes your JavaScript and compiles it into very fast machine code that your computer understands.

So node allows us to use JavaScript as a server-side technology just like Ruby on Rail, PHP, Java and like many others. Node is completely cross-platform which is runs on Windows, Mac, and Linux.

WHY NODE.JS?
Why do we use node.js?

Node is extremely fast and helps us building real-time application because of its asynchronous nature. Many companies from around the world looked for the skilled Node.Js developers. One of the benefit to use Node.js is that it is event-driven asynchronous and that uses a non-blocking I/O model

WHAT WE CAN DO WITH NODE.JS
With using node.js, we can manipulate file system no matter it is Mac, Linux or windows. We can build the web server that can handle incoming HTTP request and then send responses. Node.jS allow us to work with any database like MongoDB, MySQL, Postgres, Redis, etc. With node.Js we can build powerful Restful API that can take in HTTP request and send data back in multiple formats. You can build back-end with the node or express or some other backend framework and then combine it with front-end framework like angular, react, or view.JS and build really powerful full stack application.

By using node.js, we can build the complete server-side application that can render, view and template right on the server with multiple template engines.

WHAT IS BLOCKING AND NON-BLOCKING MODULE?
We have mentioned non-blocking module earlier in this tutorial, now the first thing we will see what I/O is and then we will come on the module.

So I/O stands for input and output and an example of I/O operation is reading and writing to a database, changing files, uploading files, making HTTP requests and getting responses. Now let see what is blocking module. Just like in PHP Apache server, we have to wait for one statement to be executed for another statement to start. But with node.js which is asynchronous and follow non-blocking, we do not have to wait for one thing to finish to start another and when initial I/O operation is done a callback fires off.

So, if we want to upload a file on blocking then we have to wait for it to upload and when it’s uploaded then the next task will start, like after completing it will show the file or redirect you to some other page. While with node.JS asynchronous non-blocking module we can perform some other task in between when the file is uploading that’s why node.js called event-driven system.

CONCLUSION:
In this Node.js tutorial, we have discussed in detail about node.js and what is runtime environment. We have also discussed that why we should use node.js and what we can do with node.js. We have also given the detailed overview about blocking and non-blocking module.

Top comments (1)

Collapse
 
grigorirena profile image
Irena Grigor

We choose Node.js because of its high performance, scalability, and asynchronous request processing capabilities. With Node.js, we can develop fast and efficient server-side applications, handle multiple concurrent connections, and create scalable web applications iwanta.tech