This article is a complete overview of NodeJS Framework.javascript
Okay let's start by the definition — NodeJs is a single threaded concurret asynchronous programming language which provides non-blocking I/O and event-driven architecture and was initially written by Rayn Dahl in 2009.html
Yes, even I didn't understand a word of it when I read it for the first time. So let's break it down.java
NodeJs became a boom when it was introduced to be a run-time environment which means something which could only be compiled on the browser to something that could run on a standalone machine. Woah !!!node
Now from being just a scripting language which is used to make only web applications to write all the backend code, now NodeJs provides developers a comfort of developing a frontend and backend in a single language 😀😀.react
NodeJs has a very big advantage of speed, versatility, performance, scalability, and non-blocking I/O model as compared to other conventional server-side programming languages like c#.c++
Also, NodeJs framework supports cross platforms, If you know java you can obviously relate here.git
Okay, but how does NodeJs has managed to be so great 😕??web
Because of its great architecture, that's because it is single threaded and non-blocking I/O model.chrome
Yes, You read it correctly it is single threaded... then how does it a non-blocking I/O system?express
To answer this question we need to understand what is event-loop?
Event-loop is one of the most important features of NodeJs framework which also explains how exactly the code gets executed in the Node environment.
Event Loop comes with the stack, some web APIs and callback queue. Event-loop can be considered as endlessly running single-threaded loop which doesn’t know how to stop.
So whenever we want to run a new chunk of code, it goes to stack for execution, but here is the twist which brings this whole non-blocking I/O model concept into the ground.
If a block of code that is going to be executed is an AJAX request, DOM operation or any other timeout function, then it is going to take time and NodeJs is an asynchronous programming language so it’s not going to wait for the response of the AJAX call or for that matter the timeout function to get over completely, instead what it will do is, the respective chunk of code will move to callback queue which works on FIFO.
Meanwhile, the event-loop which has only one job to do is to check whether the stack is empty or executing any other block of code. The moment event loop finds stack empty it moves the very first item queued in the callback queue to the stack and the process keeps repeating.
And this is how NodeJs manages to be a non-blocking I/O system and single threaded at the same time which eventually makes it a very powerful, lightweight and efficient model.
Powered by javascript V8 ENGINE :
NodeJs runs on JAVASCRIPT V8 engine which was primarily designed for google chrome. The V8 engine is written in c++ and compiles JAVASCRIPT code to machine language.
[Read: json2CSV in POST data using Node.js and Angular.js]
Here I am listing out some of the best NodeJs frameworks which can be used to build web applications.
Every new release of NodeJs is detached from its GITHUB master branch every six months. All the Even-numbered version is cut in April and every odd-numbered version in October.
Also whenever a new odd version is released the previous even-numbered version undergoes a transition to Long term support (LTS) which gives it 18 months active support from the day it is designated to LTS.
[Read: NodeJS Tools for Visual Studio 1.0 Update Release]
The very latest version of NodeJs release with long term support is version 10.x where the code name is Dubnium and was released on 24th April 2018 along with following features.
Added error codes: This is one of the major releases as error handling has always been a pain in NodeJs as for errors used to be a string message. So the only way to take any action for a particular error was a string comparison and any update in strings will ultimately require the code changes.
Performance improvement with v8 engine v6.6: V8 team claims that there is a reduction of 20% to 40% in both the compilation and parse time which provides the end user a great experience while working with applications built on NodeJs.
Support for ES modules: NodeJS hasn’t provided the full support for es modules in the v-10x release but they are working on building NodeJs own ESM spec. NodeJs Framework has been using commonJS module for modular programming which requires module.exports and requires syntax. After the release of the new ECMA SCRIPT MODULE system which uses import and export syntax, Node is also progressively working to deliver its own solution.
[Read: What is Node JS and why would I want to use it?]
Compatibility with NPM V-6x: NodeJs v-10 is shipped with the new upgrade of NPM v-6x which provides better stability, security, and performance.
And boom !!! you have learned so many things. There are tons of tutorials and resources available to learn NodeJS which you can use to learn many more new concepts of NodeJs and build great things !!!