Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // route.js
- const { User } = require('../db');
- router.post('/user/create', (req, res, next) => {
- bcrypt.hash(req.body.password, saltRounds, (error, hash) => {
- User.create({
- firstName: req.body.firstName,
- lastName: req.body.lastName,
- username: req.body.username,
- password: hash
- })
- .then(user => res.status(201).send(user))
- .catch(error => next(error))
- })
- })
Add Comment
Please, Sign In to add comment