Advertisement
Guest User

Untitled

a guest
Apr 28th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. router.post('/users', async (req, res) => {
  2.   console.log(req.body);
  3.   const user = req.body;
  4.   console.log(user);
  5.   try {
  6.     const password = await bcrypt.hash(user.password, 10);
  7.     user.password = password;
  8.     const newUser = await knex('users').insert({ user }, '*');
  9.     res.json(newUser);
  10.   } catch (err) {
  11.     res.status(user ? 500 : 400)
  12.   }
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement