SIGN UP USER POST
router.post(
"/signup",
wrapAsync(async (req, res) => {
try {
let { username, email, password } = req.body;
const newuser = new User({ username, email });
const RegUser = await User.register(newuser, password);
req.flash("success", "Welcome to WanderLust!");
console.log(RegUser);
res.redirect("/listings");
} catch (e) {
req.flash("error", e.message);
res.redirect("/signup");
}
})
);




Comments
Post a Comment