Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. router.post("/signup", (req, res, next) =>{
  2. bcrypt.hash(req.body.password, 10)
  3. .then(hash =>{
  4. const user = new User({
  5. email: req.body.email,
  6. password: hash
  7. });
  8. user.save()
  9. .then(result =>{
  10. res.status(201).json({
  11. message: 'User created!',
  12. result: result
  13. })
  14. })
  15. .catch(err => {
  16. res.status(500).json({
  17. error: err
  18. });
  19. });
  20. });
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement