I can’t figure out why when I sent a test request with Postman I get null as “resp” with the following code:
app.post('/api/login', async (req, res) => {
const {email, password} = req.body
console.log(email, password);
const resp = await User.findOne({password})
console.log(resp)
if(!resp) {
console.log("incorrect details")
} else {
console.log("logging you in")
}
res.send("k")
});
However, if I remove them, it works as expected. Can anyone explain why? It might be because I’m new to async/await.