I am new to node js and I got stuck at a very basic problem. I have couple of functions where I use the output of one function as a query param in the next param
function getCdTypeByValue (table_name,kpi_type){
//some query runs here
return id
}
insertInsight = function(req,res){
var id = getCdTypeByValue (table_name,kpi_type);
//use id in a query for insert
}
In my code the insert statement in insertInsight , needs the id returned from getCdTypeByValue. So , I need this to be a synchronous call , what are the best practises for nodejs to do this.