Promise.all(function(){
for(var numb in req.body){
console.log(numb+":"+req.body[numb]);
checkValue(numb,function(err,result){
if(result){
console.log(result);
send[result]="true";
console.log(send);
}
if(err){console.log(err+"not");}
});
}
}).then(res.json(send));
I want to execute the for loop first and then send the data back. I am trying to use promise.all but I am not sure if its correct. could someone help me out?
Promise.all(). You do not pass a function toPromise.all(). There are also no asynchronous operations in the code you show so there is no reason to use promises at all. You can just code a regular loop.