Tag: Nodejs

Home » Posts Tagged "Nodejs"
Create and Publish npm module

Create and Publish npm module

Creating and publishing an npm module is a great way to share your code with the community. Here’s a step-by-step guide to help you through the process.   Step 1: Set Up Your Project First, create a new directory for your module and navigate into it:

  Next, initialize your project with npm:

Read More

Nodejs Unit Testing

Getting Started with Node.js Unit Testing

Unit testing is crucial in Node.js applications to ensure the functionality of your routes and middleware. In an Express application, testing helps identify potential issues before deployment. In this guide, we will walk through setting up and writing unit tests for a Node.js application with Express using Mocha and Chai.   Setup: First, ensure you…

Read More

Deploying a Simple Node.js Express App with Docker

Deploying a Node.js Express App with Docker

Docker simplifies the process to deploy a Node.js Express app by packaging it into a container. In this guide, we’ll show how to deploy deploy a Node.js Express app step-by-step using Docker. Prerequisites: Nodejs Docker   Step 1: Create the Node.js Express App First, initialize a basic Express app. If you haven’t already, install Node.js…

Read More

Log File Rotation in Node.js with Express

Log File Rotation in Node.js with Express

Log file rotation in Node.js is essential for managing log size and ensuring efficient monitoring of your application. In this guide, we will implement log file rotation in a Node.js application using Express and the winston and winston-daily-rotate-file packages.   Step 1: Set Up Express for Logging First, create a basic Express app: Initialize the…

Read More

winston logger in Nodejs

Winston Logger in Node.js with Express

Logging is essential for tracking application behaviour, debugging, and monitoring. Winston logger, a versatile logging library, simplifies logging in Node.js applications. It offers features like multiple transports, log levels, and customizable formats.   Step 1: Set Up Express First, create a basic Express app: Initialize the project:

Install Express:

Create an index.js file:…

Read More

bcrypt

Hash Passwords in Node.js

What is bcrypt? Bcrypt is a password hashing algorithm designed by Niels Provos and David Mazières based on the Blowfish cipher. The name “bcrypt” comprises two parts: “b” representing Blowfish and “crypt,” which denotes the hashing function utilized by the Unix password system. This blog will show you how to use bcrypt password hashing with the…

Read More