Modules in Node Js

Modules in Node Js are collection of files containing various logic. Modules help to organize the code. The code can be used anywhere by using the modules, which results in the reusability of the code.

Modules in Node Js are similar to the libraries in JS. Modules help to breakdown the complex logic into a collection of simple ones.

Types of Modules

Core/Inbuilt Modules : We don’t have to download these modules, they are installed along with the Node Js installation. We can use core modules by just importing them in our code. Some examples of the core modules are http, fs, os, path etc.

Third Party Modules : These modules are not included with the Node Js. We have to download them in our project. Most of the packages we use are available on npm. NPM stands for Node Package Manager, npm is a code repository, where you can find almost all types of modules.

Local Modules : Local modules are created by ourselves according to the need and can be used at the place where it is required.

Module

Using the module

Leave a Reply

Your email address will not be published. Required fields are marked *