What is Node.js ?
Node.js is an open source, cross-platform runtime environment for developing networking application.
Node.js is not a framework and it’s not a programming language. it is use for building back-end services like APIs.
It is used in production by companies like Netflix, Uber, Paypal etc.
Table of Contents
What are the key features of Node.js ?
There are other languages also which we can use to build back-end services like Python, Ruby, C# so what makes Node.js different.
- It provides fast and highly scalable services compare to others.
- It has large ecosystem for open source library.
- It’s use JS everywhere, so it is easy for JS developer to build back-end services using Node.js.
- Source code is cleaner and consistent.
- It provides fast services.
This diagram saw us some important parts of Node.js
How to Download Node.js ?
The mechanics of node.js are contributes to its popularity among the developers. whereas most alternative runtime environment utilize multi-threaded processing models, node.js does it all in a single thread.
In multi-threaded processing setups, each server has a limited thread pool it can access. So every time a server receives a request, it pulls a thread from the pool and assigns it to that request, to take care of processing it. In this case, the processing is synchronous and sequential, which means that one operation is performed at a time. It is slow and inefficient. It can particularly became a problem if application has to deal with a high number of client requests.
Node.js uses single-threaded processing. It is fast and efficient compare to multi-threaded processing because in this process architectures process every request using a single main thread, utilizing event loops to run blocking Input/Output operations in a non-blocking way.
Modules in Node.js
Node.js features have modules that are kept in individual contexts so they don’t interfere with other modules of node.js.
A modules in node.js are either simple or complex which is organized in JS files and reusable throughout the node.js application.
There are three types of module in node.js : Core, Local and Third party.
- Core Module : It include the basic, bare-bones functionalities of Node.js. They load automatically when a node process starts and are part of Node.js’s binary distribution.
- Local Module : this are created within the node.js application. They include different and additional functionalities in separate files to core functionality package. It can also be packaged and distributed for use by the node.js community.
- Third party Module : It is an existing code written by a third party. It can be imported into your node.js application to expand or add different features and functions.