All posts in "Node.js"

Execute Tasks in the Loop

By Haider Malik / October 14, 2017

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 = […]


Node.js : Execute Tasks In Parallel

By Haider Malik / October 11, 2017

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 […]


Execute Asynchronous Tasks in Series

By Haider Malik / October 10, 2017

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 […]