I've a requirement where I have to call another function for a record of data before I actually perform next set of operations.
so here's what I'm doing but it doesn't work. function a is stored in a common library abc
var a = (req,callBack) =>{
DB Operation
.
.
.
.
callBack(null,result);
}
var b = (req,callBack) =>{
const c = await abc.a(req,response);
DB Operation
.
.
.
.
.
callBack(null,result);
}
when I do const c = await abc.a(req,response); it gives me error "await is only valid in async function" but I've seen examples where await is used like this.
can you please help me with this.