In this tutorial you will learn about the Nodejs Introduction and its application with practical example.
What is Node.js?
Node.js is an open-source, cross-platform run-time environment for running JavaScript applications on server-side. JavaScript is always been used as client-side scripting language, where JavaScript code is usually embedded into the HTML Web Page that is executed client-side by the user’s web browser. Node.js made it possible to use JavaScript for building server-side application. In Node.js, JavaScript code is executed server-side to produce dynamic page content before the page is being sent to the user’s web browser. Node.js offers a run-time environment which enable web applications to have a two-way real-time connections, where both the client and server can interact freely to exchange data.
Node.js is a very powerful server-side platform built on Google Chrome’s V8 JavaScript Engine. Node.js follows an event-driven, non-blocking I/O architecture which makes it perfect for data-intensive realtime applications that run across distributed network/devices. Node.js applications are very fast, lightweight, efficient, scalable and can run over variety of operating systems(OS X, Microsoft Windows, and Linux).
Node.js is completely free and provides a rich set of various JavaScript modules which simplifies the web application development.
Why Node.js?
In traditional web-serving technologies each connection (request) open up a new thread, which is prone to be blocked on I/O and handle multiple simultaneous users. Whereas Node.js operates on asynchronous non-blocking event driven I/O model, allowing it to support tens of thousands of concurrent connections, this can easily beat traditional threaded server environments like PHP and Ruby on Rails. Node.js highly efficient and scalable as compared to traditional servers which allocate limited number of threads to handle requests.
Who uses Node.js?
Node.js is trusted and backed by large enterprises running mission-critical applications. Below is a list of a few of them –
Adobe
Google
Microsoft
Netflix
PayPal
Uber
Walmart
LinkedIn
Ebay
Mozilla
etc.
Where to Use Node.js?
Node.js is perfect framework/platform for building following type of application –
- I/O Intensive Applications
- Real-time Applications like Multiplayer Games, Stock Trading, Chat App etc.
- JSON APIs based Applications
- Single Page Applications
- Data(Audio/Video) Streaming Applications
- Proxy or HTTP Web Server
- Network Applications
- High Concurrency Applications
- File Uploading Tools
- Process Monitoring Tools
Where Not to Use Node.js?
Node.js operates on single threaded environment thus it is recommended not to use Node.js for CPU intensive applications.