Companion Code for the Authentication Module on The Complete 2019 Web Development Bootcamp
440
stars
524
forks
source link
MongooseError: Model.findOne() no longer accepts a callback ... fixed using then and catch instead of use if and else method #33
Open
UmitRock opened 1 year ago
use new code of login post
});
instead of old code of login post
app.post("/login", function(req, res){ const username = req.body.username; const password = req.body.password; User.findOne({email: username}, function(err, foundUser){ if (err) { console.log(err); } else { if (foundUser){ if (foundUser.password === password){ res.render("secrets"); } } } }); });