You've probably heard about NodeJS and that it is somehow related to Javascript… But after all, what the hell is it and does the NodeJS ?

NodeJS is a Javascript execution environment. How cool, but what does it mean? How it works?

Also check: Javascript – What is it, how does it work and what is it for?

You'll likely hear developers refer to just as node and not NodeJS.

The environment node it has everything you need to run scripts in javascript, where until then* it was only possible in browsers. It allows you to use javascript as a backend language and uses the v8 javascript engine developed by Google for Chrome, so if you use this browser you are using the same javascript execution machine as node .
* NodeJS it's been around for 9 years.

V8 Engine

" V8 is the name of JavaScript interpreter , also called virtual machine Javascript (or engine) , developed by Google and used in your browser Google Chrome . V8 is a tool developed in the language C++ and distributed in the regime of open code .
The purpose of V8 is to speed up the performance of an application by compiling Javascript code to the machine's native format before executing it, allowing it to run at the speed of compiled binary code" – Wikipedia.

Why NodeJS?

" NodeJS uses an event-driven, non-blocking "I/O" model which makes it lightweight and efficient"

I/O stands for "input" and "output". This means that any task, from an HTTP call to reading a file on disk.

This is very important because the node it's single threaded (it only consumes one processor), it's not 100% true but let's keep it simple for now, so if you have any blocking functions all your code will be compromised and probably slow:

Imagine that you developed a Rest API that returns the contents of a file on disk from your server, if you develop in a blocking way, let's assume that your file is heavy and takes 1 minute to read, any next call will have to wait for reading of the first call ends so that it is answered and your reading begins. Using the non-blocking model o node "queues" these calls, starts processing them in parallel, and responds as soon as possible.

NPM

Another wonderful part of node is in your community: NPM is the package manager ("dependencies") of the NodeJS , here you will find the most varied solutions written by the community. You will probably run into situations/problems when developing that some good soul has already passed and published a package NPM to make your life easier. This entire ecosystem makes developing applications on Node fast and efficient!

Next steps

Well, now that you know what it is NodeJS I recommend that from a look at the official documentation it is very easy, intuitive and has good tutorials for writing your first application on node: https://nodejs.org

0 0 votos
Nota do Artigo
Subscribe
Notify of
guest
0 Comentários
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x