I got know about this async module ,and everyone is talking about it. As I know below code will trigger the callback when 2 db calls is done.
async.parallel([
function(){ dbcall() },
function(){ dbcall() }
], callback);
But is it compulsory to use async module? if I wrap my code properly it can be async too. Like I wrote this in controller
var Token = require('../models/token');
Token.getAllTokens(owner, function(err,callback){
var device_tokens = callback.token;
GCM_call(device_tokens); //another ajax call
});
Above code will work, I tested it, GCM_call will wait and run after getAllTokens. So why use async module? is it just to make the code more readable?