What is Node.js? JavaScript on the Server Explained
What Is Node.js
Node.js Is cross platform ,open Source Cross platform javaScript Run Time Environment that allow you to run JavaScript on the Server-side ,outside the browser . It's built on Chrome's V8 JavaScript engine, which makes it fast and efficient for building scalable and high-performance network applications
Why JavaScript was originally browser-only .
The JavaScript is added solely 1995 to add interactivity to the Web page .
So browser isolated javascript in a strict sandbox for security reasons.
No OS access : It could not access the local file system, network interfaces, or hardware.
Early engines were slow interpreters designed only for basic browser scripts .
How Node.js made JavaScript run on servers
In 2009 Ryan Dhal took Google Open Source V8 engine out of the Browser And embed it inside C++ program called Node.js .
System Access: Dahl added low-level C++ APIs to handle file systems and networking.
Unified Interface: He exposed these C++ capabilities to JavaScript.
Single Language: This allowed JavaScript to run directly on an operating system like a standard backend language.
V8 engine overview
Google V8 is a high-performance, open-source JavaScript engine written in C++. It compiles human-readable JavaScript directly into native machine code before executing it.
Event-driven architecture idea
Node.js uses an event-driven architecture to handle high concurrency with a single execution thread .
Instead of assigning a new thread to every incoming connection, Node.js triggers an event when an operation starts. It then moves on to the next task immediately. When the background operation finishes, it emits a completion event that triggers the corresponding callback function.
Real-world use cases of Node.js :-
Rest API & Microservices .
Streaming Services.
Single Page Application .
Real Time Application
Comments
Join the discussionNo comments yet. Be the first to comment.
