NodeJs

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

WHat is NodeJS Why we should use NodeJs, Blocking Module vs Non-Blocking Module

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.

Click to comment

Most Popular

To Top