Advertisement
Guest User

Untitled

a guest
Sep 11th, 2017
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. const username = req.body.username;
  2. const password = req.body.password;
  3.  
  4. if (!username) {
  5. throw new Error('Missing username');
  6. }
  7.  
  8. if (!password) {
  9. throw new Error('Missing password');
  10. }
  11.  
  12. User.findOne({ username, password }).then(user => {
  13. res.json({ user });
  14. }).catch(err => {
  15. res.json({ err });
  16. });
  17.  
  18. const username = req.body.username;
  19. const password = req.body.password;
  20.  
  21. if (!username) {
  22. res.json({ err: 'Missing username' });
  23. }
  24.  
  25. if (!password) {
  26. res.json({ err: 'Missing password' });
  27. }
  28.  
  29. User.findOne({ username, password }).then(user => {
  30. res.json({ user });
  31. }).catch(err => {
  32. res.json({ err });
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement