What is Node js
Node js is an open-source, cross-platform JavaScript run-time environment that executes JavaScript code server-side. Node js lets developers use JavaScript for server-side scripting running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser.
Node.js is a platform built on Chrome’s javascript runtime for easily building fast and scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Why Node js
A common task for a web server can be to open a file on the server and return the content to the client.
1. Here is how PHP or ASP handles a file request:
2. Sends the task to the computer's file system.
3. Waits while the file system opens and reads the file.
4. Returns the content to the client.
Ready to handle the next request.
1. Here is how Node.js handles a file request:
2. Sends the task to the computer's file system.
3.Ready to handle the next request.
When the file system has opened and read the file, the server returns the content to the client.
Node.js eliminates the waiting and simply continues with the next request.
Node.js runs single-threaded, non-blocking, asynchronously programming, which is very memory efficient.

No comments:
Post a Comment