Просто добавьте пример ответа Криса:
Использование асинхронного, https://github.com/caolan/async
async.parallel([
function(callback){
// query a database, lets say mongodb/mongoose
User.findOne({email: email}, function(err, user){
callback(err, user);
});
},
function(callback){
// Load a template from disk
fs.readFile('views/user.html', function (err, data) {
callback(err, data)
});
}
], function(err, results){
// Should have [user, template data]
});
Или со счетчиками:
var user = false,
template = false,
count = 2;
function build_user_view(){
// user, template should be available
}
User.findOne({email: email}, function(err, userDoc){
user = userDoc;
--count || build_user_view();
});
fs.readFile('views/user.html', function (err, data) {
template = data;
--count || build_user_view();
});