authRouter.post("/checkEmail", async (req, res) => {
try {
const { email } = req.body;
if (!email) {
return res
.status(400)
.json({ error: "Email address is missing in the request body." });
}
const query = "SELECT auth.is_email_exist($1);";
const result = await pool.query(query, [email]);
const isEmailExist = result.rows[0].is_email_exist;
res.json(isEmailExist);
console.log(isEmailExist);
} catch (err) {
console.error("Error checking email:", err);
res.status(500).json({ error: err.message });
}
});
This post request always gives the correct response but the request gets blocked as the response last character always gets ommitted and it is only happening with this request
I have set the content header encoding to UTF8