su consulta está bien y no da error, por lo que también debe verificar result.length> 0
y luego res.send('email not found')
router.post('/login', (req, res) => {
var email = req.body.email
var password = req.body.password
var GRAB_USER = `SELECT * FROM user_details WHERE email = ?`
db.query(GRAB_USER, email, (err, result) => {
if (err) {
res.send('email not found')
}
else if (result.length==0) {
res.send('email not found') //this is what you are missing
}
else {
var user = result[0]
bcrypt.compare(password, user.password, (err, match) => {
if (err) {
res.send('password not match')
} else {
res.send(user)
}
});
}
})
})