Category Archives for Node.js

Execute Tasks in the Loop

Execute Tasks In the Loop Using Async.each Now I am going to show you how to execute asynchronous Tasks In the Loop by using async.each const Client = require(‘node-rest-client’).Client; const restClientService = new Client(); restClientService.registerMethod(‘getPosts’, ‘’, ‘GET’); restClientService.registerMethod(‘getAlbums’, ‘’, ‘GET’); restClientService.registerMethod(‘getPhotos’, ‘’, ‘GET’); export default restClientService;   function loopDemo(req, res, next) { let users = […]

Continue reading

Node.js : Execute Tasks In Parallel

Use Case If you want to run multiple tasks and you don’t need to wait for the previous method, then you have to run the asynchronous function in parallel. In this post, I will show you how to execute asynchronous tasks in parallel by using callbacks, promises, and Async/Await.We will have three asynchronous functions. I’m […]

Continue reading

Execute Asynchronous Tasks in Series

What is Callback A callback is an asynchronous equivalent for a function. A callback function is called at the completion of a given task. function login(callback) { //do some operation callback(‘You have successfully LoggedIn’); } login(function(result) { console.log(result); });   I have created a login function. This login function is accepting one argument which is […]

Continue reading