Skip to content Skip to sidebar Skip to footer

Nodejs: Querying Ms Sql In Loop Freezes Response

I am using fetch to read data from API build in NodeJS. I have the following method: exports.read_detail = async function(req, res) { try { let pool = await new sql.Co

Solution 1:

I think the problem is that myActivities only exists within the scope of the if(resultDcn.rowsAffected[0]).

At this point the program crash.

const DcnDto = {
  "Dcn": DCNObj,
  "timeClocks": timeClocks,
  "dayActivities": myActivities
};

Recommendation: When you use async/await I suggest using a try catch.

Post a Comment for "Nodejs: Querying Ms Sql In Loop Freezes Response"