module.exports vs exports in Node.js
Let’s start by developing a simple ( or sample) Node module as shown below. The file mymodule.js contain the following lines of code to expose two functions with the properties a and b using the...
View ArticleCircular Dependency in Node.js Modules
In this post we will examine how the module initialization in Node.js is affected by the circular dependencies ( we will restrict this discussion to the CommonJS specification based module system) I...
View ArticleCircular Dependency in Node.js ES Modules
In the previous post we had discussed about circular dependency in Node.js modules using CommonJS modules specification.Here we will examine the behaviour of Node.js modules using ES Module...
View ArticleCallback Hell in Node.js/JavaScript
A callback is a function which is passed as an argument to another function and invoked with the results generated after that function execution is completed. The result is propagated to the callback...
View ArticleAsynchronous Control Flow in Node.js with async Library
The two common asynchronous control flow patterns include sequential and parallel flows. In the sequential flow, the tasks are executed one after the other in sequence and delay in one causes a delay...
View ArticlePromise in JavaScript / Node.js–Part1
As we have discussed earlier callbacks are the basic building blocks of asynchronous programming in JavaScript/Node.js , they are used for notifying when an asynchronous operation is completed. But...
View ArticlePromise in Node.js / JavaScript–Part II
In the previous post, we have discussed about the basics of Promise, here we will take a deeper look into the Promise.then function. The code below shows the promisified version of the add function...
View ArticlePromise in Node.js / JavaScript–Part III
In the previous post, we have seen Promises can be chained together by returning another Promise object from the onFulfilled parameter of the then function. The chain of Promises executes sequentially....
View ArticlePromise in Node.js/JavaScript–Part IV
In the last post, we have seen how we can sequentially execute promises using Promise chaining via the Promise.resolve and Array.prototype.reduce functions. In this post, we will see how we can execute...
View ArticleAsync/Await in Node.js/JavaScript–Part1
In the previous few posts we have discussed on Promise in JavaScript and how it helps to solve the issues related to callbacks resulting in more readable and maintainable code.In this post we will...
View Article