Introduction to Node.js

Why use Node.js?

You may hear people saying that node.js is not good, poor performance, and not for enterprise application. Before answering this question, we better to have a look to the below pros and cons. Then, we can conclude what kind of application is good to build with node.js, and what is not.



  1. No need to learn new programming language, it is JavaScript
  2. Share the same JavaScript codes with both server – node.js and client – frontend webpage.
  3. Fast processing. The V8 engine, which is the runtime engine of node.js, will compile your JavaScript into native machine code.
  4. With build-in package management tool – NPM, you can easily add NPM modules to your node.js environment.
  5. With Express or other framework, you can build Restful application easily.
  6. Good for audio / video streaming, because node.js has fast, non-blocking and asynchronous I/O.
  7. Good for real-time app.


  1. Not good if the request is CPU intensive, because it will block the entire system.
  2. Not good for reporting
  3. Not good for calculating



  1. It is single-thread, can’t handle concurrency, or multi-users. NOT 100% true, node.js has one single thread listening to your request for your program.
  • If the request is non-CPU intensive, this single thread will execute the job and return.
  • If the request is long running I/O request, this single thread will pass to the pool of native C++ threads to handle the request.
  1. It is writing in JavaScript, but don’t mix up with frontend JavaScript. Node.js is for building backend server, not frontend.
  2. Too many callbacks. Because asynchronous is a nature of Node.js. However, most of our applications’ functions may need to be synchronous, especially interacting with users. So, we may need to define our function with callback, in order to make it to be synchronous.


So, we can conclude:

Good for Bad for
non-CPU intensive CPU intensive
Simple web page Generate reports
Restful API Intensive calculation
I/O streaming CRUD application
Socket development


You can follow this blog in order to buildup some examples with node.js.

Please rate this