Node.js: Executing a Piece of Code after a Delay

August 26, 2021 A Goodman

In Node.js, we can use the setTimeout function to run a piece of code after a delay. You can call setTimeout directly or use it with async/await. Example 1 – setTimeout This code runs a function…

Mongoose: Counting Documents that Satisfy Conditions

August 26, 2021 A Goodman

Mongoose is a great open-source that is widely used when building backend with Node.js and MongoDB. It supports several built-in methods that can help us count documents that satisfy given conditions in a database collection: Model.count({…

Node + Express: How to Return XML Response

July 17, 2021 A Goodman

This article walks you through a few examples of responding in XML when using Express and Node.js. Besides express, we don’t need any other npm libraries. Example 1: Basic This example creates a list of fiction…

How to Delete a File or Directory in Node.js

July 17, 2021 A Goodman

This article shows you a couple of different ways to remove a file or a directory using Node.js. We’ll use modern Javascript (ES6 and newer) and the latest features provided by Node.js core. No third-party libraries…

Node.js: Ways to Create a Directory If It Doesn’t Exist

July 8, 2021 Guest Contributor

This article walks you through a couple of different ways to create a directory if it doesn’t exist in Node.js. Using the FS module FS which stands for “file system”, is a standard module of Node.js…

How to install Redis on macOS, Windows, and Ubuntu

June 12, 2021 A Goodman

This article shows you how to install and get Redis ready-to-use on macOS, Windows, and Ubuntu. macOS The easy and reliable way to install Redis on a Mac is using Homebrew (a free, popular, and open-source…

4 Ways to Convert Object into Query String in Node.js

June 1, 2021 Guest Contributor

This article shows you a couple of different ways to convert (stringify) objects into query strings in Node.js. Using URLSearchParams API The URLSearchParams class comes with the URL module and is available on the global object…

Node.js: How to Use “Import” and “Require” in the Same File

May 25, 2021 A Goodman

This article shows you how to enable ES6 import/export in Node.js and use both require and import in the same file. Enabling ES import/export You can use ES6 import/export in Node.js by simply adding “type”: “module”…

How to Easily Upgrade Node.js in macOS

May 24, 2021 A Goodman

Node.js is updated very often to fix bugs, improve performance and add new features. This article shows you how to correctly upgrade Node.js and npm in macOS. 1. Go to nodejs.org, the official website of Node.js,…

Node.js: Get File Name and Extension from Path/URL

April 2, 2021 A Goodman

The path module (one of the core modules of Node.js) gives us some methods to simply retrieve the name and extension of a file from a path or web URL: path.basename(path: string, extension?: string): Returns the…

6 best Node.js frameworks to build backend APIs in 2021

March 31, 2021 Guest Contributor

Node.js helps us build fast and high-performance backends for websites and mobile apps of all sizes. This job is made easier and more convenient thanks to the help of open-source frameworks. In this article, we will…

Top 4 best Node.js Open Source Headless CMS in 2021

March 31, 2021 Guest Contributor

Using a Node.js Headless CMS will help you quickly build a fast and high-performance self-hosted backend for your application with many pre-made things like admin dashboard, content CRUD (create, read, update, and delete) system, file management,…

1 2 3