kueri Anda baik-baik saja dan tidak memberikan kesalahan sehingga Anda juga harus memeriksa result.length> 0
lalu 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)
}
});
}
})
})