Node.js Core Modules: (Built-In Modules)

Modules which are available with node intallation by default are called core modules OR built-in modules in node.js.

Let's see how to use node core modules with examples:

First you need to import core module using require() (Vanilla JS) or import (In ES6).

// import http core module
const http = require('http');

http.createServer((req, res) => {
	console.log("Congrats!, Node HTTP Server is running on port 3000");
}).listen(3000);
Node.js - Utility Modules

Following are some most commonly used utility modules available in node.js

Module Description
OS Module

Provides basic operating-system related utility functions.

const os = require("os")
Path Module

Provides utilities for handling and transforming file paths.

const path = require("path")
Net Module

Provides both servers and clients as streams. Acts as a network wrapper.

const net = require("net")
DNS Module

Provides functions to do actual DNS lookup as well as to use underlying operating system name resolution functionalities.

const dns = require("dns")
Domain Module

Provides ways to handle multiple different I/O operations as a single group.

const domain = require("domain")