What is Node.js
Introductions:
Official Introduction of Node.js is as below:
"Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser."Please don't consider Node.js as a programing language. It is just a runtime environment that runs on Google's V8 (open-source JavaScript WebAssembly) Engine.
The secrete behind the popularity of Node.js is its Asynchronous behavior by default. Asynchronous (non-blocking) means that system doesn't wait for the response of one request to execute the next request.The traditional server request makes a synchronous API call, which means until 1 request doesn't complete and the response doesn't get back from the server the next request has to wait. This synchronous (blocking) API call kills the performance of the application. Node.js solves this problem efficiently.
The two main pros and cons of Node.js are as below:Pros:
1. If the Application doesn't have CPU intensive calculation, the entire application from top to bottom even the database can be built in javascript, which helps in code management, hiring resources, and the development life cycle of the application.
2. More S.E.O. friendly than traditional SPAs, (Single page applications) as Crawlers receive a fully-rendered HTML response.
Cons:
1. CPU intensive computation will block Node.js responsiveness.
2. Using Node.js with a relational database is still quite a pain