mcgraths
2/29/2016 - 9:50 AM

Async Waterfall Example

Async Waterfall Example

var async = require('async');

async.waterfall(
	[
		function(callback) {
			callback(err, param1);
		},

		function(param1, callback) {
			callback(err, param2);
		},

		function(param2, callback) {
			callback(err, param3);
		}
	],
	function(err, param3) {
		if (err) {
			console.log('Error');
		}

		console.log('Success');
	}
);