Node.js uses an event-driven, on-blocking I/O model that makes it powerful and easy to use , capable of running smoothly across distributed devices for data-intensive real-time applications.
Features of Node.js :
Following are some of the important features that make Node.js one of the most sought after platforms in today’s world:
Asynchronous and Event Driven
All the APIs of. The Node.js library is asynchronous, that is, non-blocking. It basically means a Node.js based server never waits for an API to return data. The server moves to the next API after calling it and through a notification mechanism of Events of Node.js ,the server is able to get a response from the previous API call.
Single Threaded but Highly Scalable
Node.js uses a single threaded model combined with event looping. The event mechanism helps the server to respond to a request in a non-blocking way which makes the server highly scalable as opposed to the traditional servers that create some threads for the requests handling. A single threaded program is used by node.js and the same program can help provide service to a much larger number of requests as compared to the traditional servers like Apache HTTP Server.
No data is ever buffered by Node.js applications. These applications simply output the data in chunks.
MIT license holds the right of Node.js.
Introduction to NPM and Packages
A package may be defined as one or more modules (libraries) which are grouped (or ‘packaged’) together. These are commonly used by other packages.Node.js uses a package manager, in which you can find and install thousands of other packages ready for your use.
Some important NODE.JS packages
There are thousands of packages that can be used in node.js by a developer and each has their own significance and use. Below are some of the most popular and widely used packages:
This is maintained by the Facebook community and a community of individual developers.
It is a web application framework for Node.js. It is mainly designed for building web applications and APIs. It also provides a robust set of features for mobile applications.
It serves as a high abstraction layer over node.js. It helps to create your own full backend.
This is a terminal related library which is basically created for styling the terminal strings. The API is simple, intuitive(chainable) and is one of the most widely used ones. Chalk comes with a simple to use composable API where the developer just chains and nests the styles as per their needs.
This module is used to handle and transform files paths. It provides useful functions to interact with file paths. This module provides utilities for working with directory paths and files.
This is the node.js body parsing middleware. It is used to parse incoming request bodies in a middleware before your handlers. It extracts the entire body portion of an incoming request stream and exposes it onto the required target body.
This module is for node.js applications for sending out emails. It was started in 2010 when there was no option for sending emails. Today it is used as a default for sending emails. It is a single module with zero dependencies.
This is the most popular logging solution for node.js applications. It is also implemented to log errors and messages to a file and to a console. Each Winston logger can have multiple transports( a storage device for your logs).
Sharp is a very high speed node.js module used to convert large images in common formats to smaller, web friendly formats like JPEG, PNG , WebP and TIFF images of different dimensions. Resizing using this is fastest compared to other modules.