Getting To Know About Node.js

Node.js

What is Node.js ?

  • An open source server environment
  • Uses JavaScript on the server
  • Runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)

History

  • Ryan Dahl invented Node. js in 2009.
Ryan Dahl

Why Node.js ?

Why Node.js

Because of its single-threaded nature, Node. js is best suited for non-blocking, event-driven servers. It was created with real-time, push-based architectures in mind and is used for traditional web sites and back-end API services.
additionally It uses an event-driven I/O model, which is extremely efficient and allows for the creation of scalable network applications. Node. js is a popular framework for developing real-time applications, the Internet of Things, and microservices, with over a billion downloads.

Event Loop

Despite the fact that JavaScript is single-threaded, the event loop allows Node.js to perform non-blocking I/O operations by offloading operations to the system kernel whenever possible.
Because most modern kernels are multi-threaded, they can handle multiple background operations. When one of these operations is finished, the kernel notifies Node.js so that the appropriate callback can be added to the poll queue and executed later. This will be explained in greater detail later in this topic.

Event Loop

Phases of the Event Loop

Phases of the Event loop
  • Timers: Callbacks scheduled by setTimeout() or setInterval() are executed in this phase.
  • Pending Callbacks: I/O callbacks deferred to the next loop iteration are executed here.
  • Idle, Prepare: Used internally only.
  • Poll: Retrieves new I/O events.
  • Check: It invokes setIntermediate() callbacks.
  • Close Callbacks: It handles some close callbacks

Advantages of Node.js

  • Simple to understand
  • More fast deployment
  • Improved developer efficiency and overall productivity
  • Sharing and reusing code
  • It is simple to share knowledge within a team.
Advantages of Node.js

Disadvantages of Node.js

  • When dealing with Heavy Computing Tasks, performance suffers.
  • Because of the unstable API, there have been significant code changes.
  • Code that is difficult to maintain
  • There is a high demand for experienced NodeJS developers, and there are only a few available.
Disadvantages of Node.js

Global Companies That Use Node.js

  • LinkedIn
  • Netflix
  • Uber
  • PayPal
  • NASA
  • eBay
  • Yahoo
Global Companies That Use Node.js

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store