The Power of NodeJS
In this Article we are going to introduce NodeJs, it’s best features, what problems can it solve and why you should start learning it right now.
What is NodeJs ?
wait what’s a runtime environment ?
Well a runtime environment is Hardware/Software infrastructure where a code base can be executed.
What about the V8 Google engine ?
What are the features of NodeJS ?
NodeJS is single threaded, in a single threaded model all the requests are handled by a single thread, this makes the app scalable and not consuming a lot of server side resources, a downside to this model is that not only the app will be using all the core CPU but it will also use some modules like pm2.
One of the other features of NodeJS is Non Blocking asynchronous execution, in an asynchronous model if we have an asynchronous instruction all the code following it will be divided into two categories the first one are the instructions that are non dependent on the instruction and those who are dependent.
Dependent blocks will be putted in a callback function and called as soon as the asynchronous instruction is executed.
Node package manager ( npm )
npm is one of NodeJS strongest features, it contains about 150.000 modules at your disposal with their own documentation and installing them is as easy as running the “npm install” command.
Is NodeJS Only usable for server side web applications development ?
NodeJs can be used also for desktop apps, command line tools development, creating text editors ( Atom for example ) and it can even be used for robotics.
Should I use NodeJS for every application I try to develop ?
Unfortunately NodeJS is not the solution for all the problems, it must be used only for apps that require a lot of incoming requests where each request don’t use a lot of CPU cycles otherwise this may cause a blocking on the event loop.