Skip to content

Commit

Permalink
Task2: 2D - [POST] /api/auth/register
Browse files Browse the repository at this point in the history
  • Loading branch information
rjgeng committed Feb 23, 2022
1 parent 03efa0c commit 1353482
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion api/auth/auth-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ router.post("/register", validateRoleName, (req, res, next) => {
"role_name": "angel"
}
*/

const { username, password } =req.body
const { role_name } = req
const hash = bcrypt.hashSync(password, 8)
User.add({username, password: hash, role_name})
.then(newUser => {
res.status(201).json(newUser)
})
.catch(next)
});


Expand Down

0 comments on commit 1353482

Please sign in to comment.