Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is the route... So I send a POST to localhost/api/user/new with the body...
- apiRoutes.post('/user/new', function(req, res) {
- var user = {
- name: req.body.name,
- username: req.body.username,
- password: req.body.password,
- email: req.body.email,
- created_at: db.fn.now(),
- updated_at: db.fn.now(),
- };
- hashPass.new(user.password, function(result){
- user.password = result;
- console.log(result);
- })
- });
- // This is the hashPass.new function
- new: function(password, callback){
- var hashed;
- bcrypt.hash(password, 10, function(err, hash){
- return hashed;
- });
- callback();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement