Writtern And Introduced By : Ryan Dahl in 2009.
Official Website : https://nodejs.org
Github : https://github.com/nodejs/node
Download Nodejs : https://nodejs.org/en/download/
Node.js is open source, completely free, and used by thousands of developers around the world.
Non blocking means that while we are waiting for a response for something outside of our execution chain e.g. loading some data, reading from a database or polling a remote service, we continue executing the next tasks in the stack. This concept is revolutionary and make NodeJS extremely fast and efficient.
NodeJS is a single threaded language which in background uses multiple threads to execute asynchronous code. It is non-blocking which means that all functions or callbacks are delegated to the event loop and they are ( or can be ) executed by different threads. That is handled by NodeJS run-time.
All APIs of Node.js library are asynchronous, that is, non-blocking. It essentially means a Node.js based server never waits for an API to return data. The server moves to the next API after calling it and a notification mechanism of Events of Node.js helps the server to get a response from the previous API call.
What is the difference between Synchronous and Asynchronous?
Synchronous : Execute something synchronously, you wait for it to finish before moving on to another task.
Asynchronous: Ask for something to happen, get notified when it does. Do other stuff in the meantime.
The server can respond to multiple requests at a time. It won't stop or block any API request and will respond to all when the response is ready to send accordingly.
Every thing is event based. Such kind of approach will fire callback (functions most of the time) as the event occur (state changes). An event based system is always be in circular loop to execute it's responsibilities
npm is the world's largest Software Registry.
The registry contains over 700,000 code packages.
Open-source developers use npm to share software.
Many organizations also use npm to manage private development.
npm is free to use.
You can download all npm public software packages without any registration or login.
C:\>npm install <package>
- All npm packages are defined in files called package.json.
Node.js applications never buffer any data. These applications simply output the data in chunks. so user can easily view the videos or stream without interruption.
Since it's a lightweight technology tool, using Node.js for microservices architecture is a great choice.
Accordingly, breaking the application logic into smaller modules, micro-services, instead of creating a single, large monolithic core, you enable better flexibility and lay the groundwork for further growth. As a result, it is much easier to add more micro-services on top of the existing ones than to integrate additional features with the basic app functionality.
According to the latest survey made by NodeJS, web applications are the top use case with the share of 85%. Taking into account all the strengths and weaknesses of this JS run-time environment, we composed a list of the hands-on solutions where you can leverage the technology.
A single-page app (SPA) involves the allocation of an entire application on one page. In that case, Node.js app development is a good fit for making SPAs due to its asynchronous data flow on the backend. The event loop "catches" simultaneous client's requests which provides a smooth data update. In practice, it eliminates the necessity of refreshing the page every time to get new data.
Streams are one of the fundamental concepts that power Node.js applications.
Every day we use streaming services for listening to music or watching videos. Without downloading the content, we can bring your favourite TV series just on the internet.
So is Nodejs a good choice to stream data? Of course! It has built-in streams module allowing you to transmit a huge amount of data in chunks, sequentially. Thanks to this, you don't have to temporarily store or cache data in your application memory at all. Also, you can work on chunks while streaming, so e.g. encoding a video won't be a problem anymore.
Node.js provides all basic functionalities for building real-time chats of any complexity. In particular, Node has a powerful Event API that facilitates creating certain kinds of objects ("emitters") that periodically emit named events "listened" by event handlers.
Thanks to this functionality, Node.js makes it easy to implement server-side events and push notifications widely used in instant messaging and other real-time applications.
Application programming interfaces (APIs) based on representational state transfer (REST) hold a fundamental position in building modern enterprise software architectures.
A REST Server simply provides access to resources and REST client accesses and modifies the resources using HTTP protocol. Here each resource is identified by URIs/ global IDs. REST uses various representation to represent a resource like text, JSON, XML but JSON is the most popular one.
Node.js offers Express.js framework to build the lightweight and fast REST APIs.
Real-time collaboration applications offer a wide variety of software solutions for co-browsing, project management, video and audio conferencing.
Node.js is very good at handling lots of I/O operations, you can use it to build a real-time application, for example, a chat room where people can talk to each other in real-time. Or maybe a collaboration tool, where co-workers will work on the same document at the same time. Building a video conference app also won't be a problem. It is possible thanks to Node's Events API and WebSockets.
As in the case of the real-time chats, Node's asynchronous and event-based architecture is a great fit for collaboration apps. In these applications, many events and I/O requests occur concurrently. For example, several users can edit the same paragraph, comment, post messages, and attach media. Changes to one piece of content might be applied only after a cascade of events, where each step depends on the previous one.
Another common use-case in which web-sockets fits perfectly: we can track website visitors and visualizing their interactions in real-time. You could be gathering real-time stats from your user, or even moving it to the next level by introducing targeted interactions with your visitors by opening a communication channel when they reach a specific point in your site
Imagine how you could improve your business if you knew what your visitors were doing in real-time - if you could visualize their interactions. With the real-time, two-way sockets of Node.js, now you can.
MERN Stack : MongoDB + ExpressJS + React+ NodeJS
MEAN Stack : MongoDB + ExpressJS + Angular + NodeJS
MEVN Stack : MongoDB + ExpressJS + VueJS+ NodeJS
Node.js is increasingly becoming a go-to technology for multiple companies across the globe. As Node.js emphasizes on concurrency, speed, and intensive data exchange along with employing push technology over web sockets, it has helped companies to build various applications such as social media apps, video and text chat engines, real-time tracking apps, online games and collaboration tools. Here are global giants who trusts NodeJs :
10 Global Companies that rely on NodeJS
"This is simple, Node.js is a clear market winner. So, Now you know how NodeJS rule the Web Development world, why it is so popular and where it can be implemented. You can decide whether Node.js is a good fit for you, and launch your first web app with NodeJS."
References : nodejs.org, software house, netguru
"If you wanna CODE then start learn NODE…!"
If you want me to make an article on any concept then leave the topic down in the comments.
Feedback are most welcome