This is how you do it:
//program start point//
customfunction(specificfunctioncall);
and in customfunction():
function customfunction(callback){
asynchronousDBcall(function(err,body){
callback();
});
}
Functions are just data that you can pass around just like strings and numbers. In fact, with the anonymous function wrapper function(){...}
you can treat CODE as just data that can be passed around.
So if you want some code to execute on the completion of the DB call instead of a function just do this:
customfunction(function(){
/* some code
* you want to
* execute
*/
});