Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at new NodeError (node:internal/errors:400:5) the error was occuirng again and again also tried try catch can anyone say how to solve it an its reasons?
try {
resultset[0].json = JSON.parse(resultset[0].json);
return res.json({
success: true,
data: resultset,
code: 200
});
} catch (err) {
console.log("Error parsing JSON string" + err);
return res.json({
success: true,
msg: "json format was wrong",
code: 200
});
}
}
i also tried this?