Skip to content

Category: Node JS

Convert HTML to Pug in Node.js

We can use the html2pug npm package to convert HTML to Pug in JavaScript / Node.js. The fragment option tells html2pug whether to wrap your HTML in an tag, if it isn’t […]

Limit API requests in express.js

In this tutorial we are going to use an npm package called express-rate-limit. Install it using the following command. This library provides a brute-force protection for express routes by rate-limiting […]

Get file size in Node.js

To get file size in Node.js, the following code snippet would help. statSync() method from fs package synchronously returns information about the given file path the file size in bytes.

How to make an Axios DELETE request?

Making a DELETE request in Axios is very similar to making a POST or GET request. Let’s assume we are making a DELETE request to delete a user. The endpoint […]

Remove unused npm modules from package.json

Depcheck is a tool for analyzing the dependencies in a project to see: how each dependency is used, which dependencies are useless, and which dependencies are unused from package.json. To identify […]

Add JWT Authentication to your Swagger API docs

In this tutorial let’s discuss how to add authentication to your Swagger APIs, specifically JWT. Your APIs should be authenticated with some authentication schemes to secure them from online attacks. […]

How to make an Axios POST request?

In this post let’s take a quick look at how to make a POST request in Node.js with Axios npm package. We have already taken a look at how to […]

How to get node version programmatically?

In this small tutorial, we will learn how to get the version of node programmatically from your Node.js source code. In Node.js, version of the node can be retrieved using […]

How to Dockerize your node.js application?

In this tutorial you will learn how to containerize/dockerize your existing node js application with Docker. You will also learn how to add instructions to a Dockerfile to dockerize a […]

How to uninstall npm modules in node.js?

In this small post, find out how to uninstall npm packages from a node.js project or globally. Any npm package can be installed easily using the npm install command. But […]

Proxying npm packages using Nexus

In this post, you will learn how to use your Nexus npm proxy repository as a proxy for your node js project’s npm packages. You also learn how to concfigure […]

How to configure npm with npmrc?

In this article, we will discuss the basics of npm configuration file called npmrc and the various ways npmrc can be configured. One of the most important features of the […]

File downloads using node.js and Express

In this article, we will quickly go through how to send files in the response in an Express JS application that can be downloaded and saved by the browser. Express.js […]

Update an Excel file in node.js

In this post, you will learn how to update a Microsoft Excel spreadsheet in node.js. We have already seen how to read an excel file in node.js using the npm […]

Real an Excel file in node.js

In this post, you will learn how to read a Microsoft excel file (.xls, .xlsx) in node.js. Microsoft Excel is the widely used spreadsheet application whose file extensions are .xls, […]

Generate UUID in Node JS

There are multiple ways to generate random UUID in Node JS. The fastest possible way to create random 32-char string in Node is by using native crypto module. Let’s see one by […]

Install NodeJS on Ubuntu 19.04

In this tutorial, I’m going to show you how to install Node.js on Ubuntu 19.04 / 18.04. Once you are done, you’ll have Node.js installed and be ready to start […]

Blocked by CORS policy error – How to fix?

Cross-Origin Resource Sharing (CORS) is a technique that makes use of additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources […]