Thursday, 21 May 2020

Question on passing from backend to frontend

Pushing an error message to user.​Let's say I have this code, after checking my database from a login.const emailExist = await User.findOne({email: req.body.email});if (emailExist) return res.status(400).send('Email already exists!')​Instead of res.sending to the user, I'd the error message to alert the user on screen. How can I pass that message to the front end, for the user to see?​Is it as simple as moving the code into the frontend via EJS?​Thanks

Submitted May 21, 2020 at 08:33PM by LordBadgerFlaps

No comments:

Post a Comment