A simple NPM module that helps you to manage asyncronous operations and avoid callback hell, code smell or spaghetti code.
sudo npm install flowmaster
sudo npm install
sudo npm install -g mocha
mocha
NB: You must have MongoDB running locally. The test wasn't configured to use MongoDB connection authentication. You can add authentication on line 115 of FlowMasterSpec.js, the test file can be found inside the "test" folder.
Although this module's test uses MongoDB database asyncronous operations, the module does not have to be used to manage only async db ops. You can use it to manage any type of asyncronous operations in Node.js.
If any functions supplied to the FlowMaster.series() returns an error, the entire operation is aborted.
Ensure that your functions return acceptable callback formats when using FlowMaster.series().
callback(err, {status: 'failed', message: 'YOUR_ERROR_MESSAGE'});
callback(null, {status: 'success', message: 'YOUR_SUCCESS_MESSAGE', data: yourResponseData});
More examples can be found in the test file: /test/FlowMasterSpec.js