app.post("/register", (req, res) => {
let id = req.body.id;
let name = req.body.name;
let email = req.body.email;
cmd = "INSERT INTO emp VALUES(" + id + ", '" + name + "', '" + email + "')";
conn.connect((err) => {
if (err) throw err;
conn.query(cmd, (err, res) => {
if (err) {
throw err;
} else {
res.sendFile(__dirname + "/result_page html/endpage.html");
}
});
});
});
I tried using res.sendfile inside conn.query but it said res.sendfile is not a function. How do i fix this.
New contributor
user26503803 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.