What is Node-JS ?

What is Node-JS : Node JS is an open-source server side runtime environment built on Chrome’s V8 JavaScript engine. It provides an event driven, non-blocking (asynchronous) I/O and cross-platform runtime environment for building highly scalable server-side application using JavaScript.

Node.js can be used to build different types of applications such as command line application, web application, real-time chat application, REST API server etc. However, it is mainly used to build network programs like web servers, similar to PHP, Java, or ASP.NET.

what makes Node.js different I am going to explain.

  1. It’s easy to get started and can be used for prototyping and agile development
  2. It provide fast and highly scalable services
  3. It uses JavaScript everywhere so it’s easy for a JavaScript programmer to build back-end services using Node.js
  4. Source code more cleaner and consistent.
  5. Large ecosystem for open source library.
  6. It has Asynchronous or Non blocking nature.

The Node.js run-time environment includes everything you need to execute a program written in JavaScript. Node.js came into existence when the original developers of JavaScript extended it from something you could only run in the browser to something you could run on your machine as a standalone application.

  1. let’s understand the other two lines so we can find out why Node.js is so popular.
  2. I/O refers to input/output. It can be anything ranging from reading/writing local files to making an HTTP request to an API.
  3. I/O takes time and hence blocks other functions.

Blocking I/O
In the blocking method, user2’s data request is not initiated until user1’s data is printed to the screen.

If this was a web server, we would have to start a new thread for every new user. But JavaScript is single-threaded (not really, but it has a single-threaded event loop, which we’ll discuss a bit later). So this would make JavaScript not very well suited for multi-threaded tasks.

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.

This non-blocking I/O eliminates the need for multi-threading since the server can handle multiple requests at the same time.

What is NPM – npm (Node package manager) has packages you can use in your apps to make your development faster and efficient.

Advantages

  1. Easy Scalability:
  2. Real time web apps:
  3. Fast Suite:
  4. Easy to learn and code:
  5. Advantage of Caching:
  6. Data Streaming:
  7. Hosting: Corporate Support:

Discover more from mycodetips

Subscribe to get the latest posts sent to your email.

Discover more from mycodetips

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top