Advertisement
izznogooood

Untitled

May 16th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. router.post('/users/login', async (req, res) => {
  2.     try {
  3.         const user = await User.findByCredentials(req.body.email, req.body.password);
  4.         const token = await user.generateAuthToken();
  5.  
  6.         res.send({ user: user, token });
  7.     } catch (e) {
  8.         res.status(400).send();
  9.     }
  10. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement