I have been trying to bringout json of junk pattern as below:
{"abc" : [ .... ] , "def":{"x":"3","y":4"}}
As per below code, I am able to get only abc object in response and not def in response. Could guess it is due to promise but ain't sure how to resolve. Please favour.
let finalData={};
db.zzz.findAll({where:condition}).then(output=>{
finalData.abc=output; //output is array
db.xxx.count({where:condition}).then(count=>{
finalData.def.x=something;
finalData.def.y=count;
return finalData.def;
});
res.send(finalData);
});