Introduction to Node JS



Let's talk about node js; the most powerful JavaScript platform.


Node JS is a JavaScript runtime environment. Okay! Sounds good. Right? But what does that mean?  Node JS runtime environment includes everything that we want to execute a program written in JavaScript.

Node JS came into existence intending to create real-time websites with WebSockets. It is an open-source, free, cross-platform runtime environment for developing server-side and networking applications.    


Why Should I Use Node JS?

  • Extremely Fast
Node JS is created on Google Chrome's JavaScript Engine(V8 Engine). So in code execution, its library is really fast.
  • I/O is Event-Driven and Asynchronous
All APIs of the Node JS library are asynchronous. Because of that Node JS based server never waits for an API to return data. The server goes to the next API after calling it and a Node JS notification mechanism events support the server to get a response from a previous API call.
  • Single-Threaded
Node JS follows a single-threaded prototype with event looping.
  • Open Source
Node JS has a large open-source community that produces many great modules to add additional capabilities. 
  • Highly Scalable
The event mechanism in Node JS supports the server to respond in a non-blocking way. So that Node JS is highly scalable.
  • License
Node JS has released under the MIT license.
  • No Buffering
Node JS cuts down the entire processing time while uploading audio and video files. These applications never buffer any data. It outputs the data in chunks.

What Can Node JS Do?

  • Generating a dynamic page content
  • Write, Read and Delete the files on the server
  • Create, Open and Close the files on the server
  • Add, Update and Delete the data in the database
  • Collect form data

Event Loop in Node JS



Though Node JS is a single-threaded application, it supports the concepts of events and callbacks. This event loop allows Node JS to perform non-blocking I/O operations by offloading operations to the system kernel wherever it's possible. 

As most of the modern kernels are multi-threaded, they can handle multiple operations that are executing in the background. When the operations complete the kernel informs Node JS. Then an appropriate callback may be added to the poll queue. 

Call Stack




Queueing Function Execution





ES6 Job Queue



Advantages of Node JS

  • Node JS offers easy scalability for microservices
  • Easy to learn
  • Use as a single programming language
  • Known for offering high performance
  • Offers freedom to develop apps
  • Getting support for commonly used tools
  • Highly extensible
  • Handle the request simultaneously
  • The advantage of Caching
  • Strong corporate support
  • Rich ecosystem
  • Seamless JSON support

Advantages of Node JS

  • Performance bottlenecks with heavy computation tasks
  • Callback hell issue
  • Immaturity of tooling
  • Growing demand for experienced professionals










Comments

Popular posts from this blog

What is Application Framework

What REST Services Are

Application Framework Project