What is Node.js

Node.js is a JavaScript runtime built on the V8 javascript engine. It allows JavaScript to go out of the client-side browser and build server applications.

Node.js is perfect for I/O-intensive servers, as it uses an asynchronous, event-driven model.

Used for developing real-time web applications, general-purpose applications, and distributed systems.

Why Node.js?

based on JS, so devs can easily shift to backend without lerning new lanaguage.

node servers are very fast, especially for havy I/O operations. which is sutable for web servers.

node.js has huge support of libraries which can help while integrating various functionalities in backend.

How does Node.js work?

how node works is heavily rely on the snynchronous and non blocking nature of java script which ccomes from the event loop architecture JS uses for code execution.

event loop….

Why Node.js is single threaded.

node is a JS runtime and JS was invented to just add some interactivity to the browser which can be handled in one core. this is a historical reason for it, but this is not it. node follows an event-driven, non-blocking model, which allows it to efficiently handle many requests without the overhead of multiple threads.

If Node.js is single-threaded, then how does it handle concurrency?

Even if the node is single-threaded it is able to handle concurrency because of its event loop architecture. It delegates some heavy tasks like database network queries to the web API or worker threads which eventually execute tasks in a multithreaded environment.

How would you define the term I/O?

The term I/O means input/output reffers to communication between diffrent things, like communication with client, databsae, file system etc.

What is NPM?

NPM stands for Node Package Manager, responsible for managing all the packages and modules for Node.js.