The Node Ecosystem
The Node Ecosystem
The Node.js ecosystem consists of various libraries, modules, and tools that
enhance development productivity and enable developers to build powerful
applications.
NPM
➔ NPM is the default package manager for Node.js.
➔ It is maintained on http://npmjs.org
-`fs`: File system operations for reading, writing, and manipulating files.
- `http`: Provides HTTP server and client capabilities for building web applications.
- `path`: Utilities for working with file paths and directory structures.
➔ Express is a minimal and flexible Node.js web application framework that provides a
robust set of features for web and mobile applications.
➔ Provides essential features and middleware for routing, handling HTTP requests,
managing cookies, and more.
➔ The program doesn’t block, and other tasks can continue their execution
simultaneously. When the asynchronous operation finishes, a callback function or
a promise is used to handle the result or trigger further actions.
ECMAScript
➔ Specifications, standards or rules for a scripting language.
Debugging
➔ Debugging tools like Visual Studio Code, Node Inspector, or Chrome DevTools to
simplify the debugging process.
➔ Node.js provides built-in debugging capabilities using the ` — inspect` flag.
Event loop
➔ It initialise when application starts, listens and executes all the events and
callbacks of the events.
➔ It works on a single threaded concept but can perform many I/O operations
concurrently with the help of OS.
➔ Callbacks are scheduled once the function has completed execution so the other
functions can be completed without blocking.
Modules
➔ Code is encapsulated in modules to make it reusable.
➔ Node.js has many popular inbuilt modules.
➔ We can build our custom modules also.
Example: creating a custom module
circle.js
Libuv
➔ A cross-platform, open-source library written using C language.
➔ It is responsible for the asynchronous nature of Node.js.
➔ Primarily developed for node.js but is now used by Luvit, Julia, uvloop etc.
Buffer & Stream
➔ Node.js provides the Buffer and Streams API.
Clusters
➔ Cluster module -allows applications to take advantage of multi-core processors.
➔ By creating child processes each running on a separate core which distributes the
workload across multiple cores
➔ improves application performance and scalability.