Open UmitRock opened 1 year ago
app.post("/register", function(req, res) { const newUser = new User({ email: req.body.username, password: req.body.password });
newUser.save().then(function(){ res.render("secrets"); }).catch(function (err){ console.log(err); }); });
app.post("/register", function(req, res){ const newUser = new User({ email: req.body.username, password: req.body.password }); newUser.save(function(err){ if (err) { console.log(err); } else { res.render("secrets"); } }); });
use new code of register post
app.post("/register", function(req, res) { const newUser = new User({ email: req.body.username, password: req.body.password });
newUser.save().then(function(){ res.render("secrets"); }).catch(function (err){ console.log(err); }); });
instead of old code of register post
app.post("/register", function(req, res){ const newUser = new User({ email: req.body.username, password: req.body.password }); newUser.save(function(err){ if (err) { console.log(err); } else { res.render("secrets"); } }); });