Guest User

Untitled

a guest
Nov 8th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. // route.js
  2. const { User } = require('../db');
  3.  
  4. router.post('/user/create', (req, res, next) => {
  5.  
  6. bcrypt.hash(req.body.password, saltRounds, (error, hash) => {
  7.  
  8. User.create({
  9. firstName: req.body.firstName,
  10. lastName: req.body.lastName,
  11. username: req.body.username,
  12. password: hash
  13. })
  14. .then(user => res.status(201).send(user))
  15. .catch(error => next(error))
  16.  
  17. })
  18.  
  19. })
Add Comment
Please, Sign In to add comment