How to decide when to use Node.js?
What is Node.js?
In general, Node.js is:
- Very good when you need to do several things at the same time.
- An event-based and all the wonderful Ajax-like stuff can be done on the server side;
- Let's share code between the frontend and the backend.
- Talk to database and have the I/O controls;
For more about Node.js and its Advantages & Disadvantages.
When to use Node.js
My feeling is that Node.js is especially suited for applications where you would like to maintain a persistent connection from the browser back to the server. Using a technique known as "long-polling", you can write an application that sends updates to the user in real time. Doing long polling on many of the web's giants, like Ruby on Rails or Django, would create immense load on the server, because each active client eats up one server process. This situation amounts to a tarpit attack. When you use something like Node.js, the server has no need of maintaining separate threads for each open connection.
This means you can create a browser-based chat application in Node.js that takes almost no system resources to serve a great many clients. Any time you want to do this sort of long-polling, Node.js is a great option.
In addition, it's worth pointing out that Node.js is also great for situations in which you'll be reusing a lot of code across the client/server gap. A lot of folks are suggesting this might be the future of web development.
References & Resources
- Dependency injection
- Directives and Pipes
- Data binding
- HTTP Get vs. Post
- Node.js is everywhere
- MongoDB root user
- Prefer Async Script Loading
- Components, Bootstrap and DOM
- What is HEAD in git?
- Show the changes in Git.
- What is AngularJS 2?
- Confidence Interval for a Population Mean
- Accuracy vs. Precision
- Sampling Distribution
- Working with the Normal Distribution
- Standardized score - Z score
- Evaluating the Normal Distribution
- What is Nodejs? Advantages and disadvantage?
- How do I debug Nodejs applications?
- Sync directory search using fs.readdirSync