In the world of Node.js, async/await has become a staple for handling asynchronous operations. It’s clean, easy to read, and feels synchronous. But as wonderful as it sounds, misusing async/await can introduce performance bottlenecks that slow down your application. If your app feels sluggish despite using async/await, this post is for you. Why Async/Await Feels Slow Under the hood,… Continue reading How Async/Await Can Slow Down Your Node.js App
Tag: nodejs
Building a Search Engine Using Node.js and Elasticsearch
Search engines are an essential part of today’s web applications. They help users find relevant content quickly and easily. Elasticsearch is a popular open-source search and analytics engine that can be used to build powerful search engines. In this blog post, we will explore how to build a search engine using Node.js and Elasticsearch. Prerequisites… Continue reading Building a Search Engine Using Node.js and Elasticsearch
How to Create and Manage Background Jobs with Node.js and BullMQ
If you’re a Node.js developer, then you’re likely to be well-versed in the need to execute background jobs that could take an indeterminate amount of time to complete. The objective of such jobs may be image processing, report generation, or email transmission. If they were to be executed on the primary event loop of your… Continue reading How to Create and Manage Background Jobs with Node.js and BullMQ
Debunking Common NodeJS Misconceptions
Some misconceptions Nodejs is single threaded: Yes and No. Yes when you think of Event loop, V8 and No when you’re think of a thread pool.. The javascript code i.e. execution context is single threaded. So if you block by running some js intensive operation it might block the event loop. Nodejs used thread pool for… Continue reading Debunking Common NodeJS Misconceptions
Async IO in NodeJS
Deep dive in Nodejs Internals (Blocking, Non-blocking IO, select/poll/epoll, event loop) We all know by now that Nodejs scales, but why & how? is the question asked by many to no satisfactory answer as there is a lack of satisfactory answers as most of the content available online does not cover the internal workings and provides… Continue reading Async IO in NodeJS
Clustering and PM2: Multitasking in NodeJS
Deep Dive in Cluster and PM2 What & Why is Clustering was needed? We are well aware that NodeJS is not specifically built for CPU-intensive tasks because of its single-threaded architecture. However, this doesn’t mean that we can’t make use of it for such tasks. In fact, NodeJS offers a couple of options to handle… Continue reading Clustering and PM2: Multitasking in NodeJS
Child Processes: Multitasking in NodeJS
Deep Dive in Child Processes, Spawn, Exec, ExecFile, Fork, IPC What exactly Child Processes are then? When you run the NodeJS application it’ll have its own process just like any other application you run, may it be VS Code, VLC Player etc. The properties of this process is available on Global object’s process variable that we can… Continue reading Child Processes: Multitasking in NodeJS
Worker Threads : Multitasking in NodeJS
Deep Dive into Worker threads Why do we need worker threads at all? A server can quickly become overwhelmed by a CPU-intensive workload. To illustrate, imagine you have two endpoints: one performs a simple, non-CPU intensive task, while the other handles a complex CPU-intensive operation that takes 10 seconds to complete. If your server is… Continue reading Worker Threads : Multitasking in NodeJS
Encryption of the Data in Node JS for the Bank integration
Here is the encryption doing for the request body from the node js application const express = require(‘express’); const router = express.Router(); const axios = require(‘axios’).default; const mycrypto = require(“../../../javascript/crypto”); const fs = require(‘fs’); const path = require(‘path’); const aesjs = require(“aes-js”); const { RSA, Crypt } = require(‘hybrid-crypto-js’); const rsa = new RSA(); const… Continue reading Encryption of the Data in Node JS for the Bank integration
Hybrid decryption using node js
Here is an example of the decryption function which can be used for the decryption of the encrypted data const encryptedKey1 = fs.readFileSync( path.resolve(__dirname, “../../../../keys/encryptkey.txt”), “utf8”); const EN_PATH = path.resolve(__dirname, “../../../../keys/encrypt.txt”); const EN_KEY = fs.readFileSync(EN_PATH, “utf8”); var key = await mycrypto.decryptViaPrivateKey(encryptedKey1, GTEN_PRIKEY_PATH, PASS); const aescbc = new aesjs.ModeOfOperation.cbc(aesjs.utils.utf8.toBytes(key), “”); let _decryptedText = aescbc.decrypt(Buffer.from(EN_KEY, “base64”)); _decryptedText… Continue reading Hybrid decryption using node js