What is Node js ?
Node.js is an open-source, cross-platform JavaScript runtime environment that allows developers to run JavaScript code outside of a web browser. It is built on Chrome’s V8 JavaScript engine and enables the execution of JavaScript on the server-side. Node.js is commonly used to build scalable and high-performance network applications. It operates on a non-blocking, event-driven architecture, making it lightweight and efficient, particularly suitable for real-time applications like web servers, chat applications, APIs, and more.
1st create below file and put the code
hellow.js
console.log("Hey this is amit kumar");
2nd open run bellow command in terminal
node hellow.js
Benefits of using Node js
- Asynchronous and Event-Driven: Node.js operates on a non-blocking, event-driven model, allowing it to handle multiple concurrent connections efficiently without blocking the execution of other tasks.
- JavaScript Everywhere: Node.js enables developers to use JavaScript not only for client-side scripting but also for server-side programming, providing a unified language across the entire application stack.
- V8 JavaScript Engine: Node.js leverages the V8 JavaScript engine, which is known for its high performance and optimized code execution.
- NPM (Node Package Manager): Node.js comes with npm, a package manager that provides access to a vast ecosystem of reusable libraries and modules, simplifying the development process by offering solutions for various tasks, such as web frameworks, database drivers, authentication middleware, and more.
- Scalability: Node.js applications can easily scale to handle a large number of concurrent connections due to their non-blocking architecture and efficient event handling.