Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- router.post("/signup", (req, res, next) =>{
- bcrypt.hash(req.body.password, 10)
- .then(hash =>{
- const user = new User({
- email: req.body.email,
- password: hash
- });
- user.save()
- .then(result =>{
- res.status(201).json({
- message: 'User created!',
- result: result
- })
- })
- .catch(err => {
- res.status(500).json({
- error: err
- });
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement