💣 Introduction to Node.js💣

💣 Introduction to Node.js💣

What Is Node.js it's installation and How does it work?

Node.js is an open-source JavaScript runtime environment built on Chrome’s V8 JavaScript Engine😄.

Because of the asynchronous event-driven runtime and non-blocking process, it makes the app lightweight, efficient, and perfect for data-intensive 🤗applications across distributed devices.

  • Node.js keeps on sending requests to the server without waiting for the request to be served first.

  • It operates on a single thread supporting tens of thousands of parallel connections.

Ryan Dahl created Node.js in 2009. He built it on Google Chrome’s JavaScript V8 Engine. Node.js has undergone many rounds of development since then, and it will likely see much more of it🤠.

  • Node.js was created to create server-side and networking applications. Creating scalable and fast web apps was another key objective for creating Node.js.

What Is Node.js?🤔

Node is a runtime built on Chrome’s V8 JavaScript engine. It is basically writing JavaScript for the server side. It is designed for building scalable network applications. Node uses an event-driven, non-blocking model that makes it lightweight and efficient.

It can be downloaded from this link node.js💥

  • Step-1: Downloading the Node.js

The first step to install Node.js on windows is to visit the official Node.js

node1.png

  • Step-2: Running the Node.js installer.

Welcome To Node.js Setup Wizard.

Select “Next”

node2.png

  • After clicking “Next”, End-User License Agreement (EULA) will open.

    Check “I accept the terms in the License Agreement”
    Select “Next”
    

    node3.png

  • Destination Folder

Set the Destination Folder where you want to install Node.js &

Select “Next”

node4.png

  • Custom Setup

    Select “Next”
    

    node5.png

  • Ready to Install Node.js.

    Select “Install”
    

    node6.png

  • Complete the Node.js Setup Wizard.

    Click “Finish”
    

    node7.png

  • Step 3: Verify whether Node.js is properly installed or not.

To check that node.js was completely installed on your system or not, you can run the following command in your command prompt or Windows Powershell and test it:-

node -v

prompt.png

How Does Node.js Work?👩‍🎓

Compared to other platforms, Node.js has a particular workflow. It operates as a single process, which means it doesn’t create a new thread for every request😯. A thread is a set of instructions that need to be performed by the server.

Node.js employs non-blocking I/O operations – when a client sends a request to the web server, the single-threaded event loop picks it up and sends it to a worker thread for processing.

Instead of blocking the thread and wasting CPU resources by waiting for a response, Node.js will continue working on the next task🤓. This way, it can handle a massive amount of concurrent requests.

That said, Node.js is not suitable for CPU-intensive tasks as it could prevent the main thread from handling other requests, effectively blocking it..😵

“Hello, World!” the Node.js Way🖐️

You can check that Node is installed on your system by opening a terminal and typing node -v. If all has gone well, you should see something like v18.12.1 displayed. This is the current LTS version at the time of writing.

  • Next, create a new file hello.js and copy in the following code:
console.log("Hello, World!");
  • This uses Node’s built-in console module to display a message in a terminal window. To run the example, enter the following command:
node hello.js

ss.png If Node.js is configured properly, “Hello, World!” will be displayed.

Conclusion 🙆‍♀️

Node.js is an open-source, cross-platform JavaScript runtime environment used to develop scalable server-side and networking applications. It uses the Chrome V8 JavaScript execution engine.

Processing a request with Node.js is efficient and lightweight🤗. The software is suitable for data-intensive and real-time applications, such as real-time chats, data streaming, server-side proxies, system monitoring dashboards, REST APIs, and SPAs.

We hope that this article has helped you understand Node.js.

Thanks for reading!!!!!!!!!🥰

Did you find this article valuable?

Support Chhakuli Zingare by becoming a sponsor. Any amount is appreciated!