Advertisement
diegoaguilar

Signup

Sep 22nd, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     app.route('/signup')
  2.  
  3.         .post(function (request,response) {
  4.  
  5.             var newUser = {
  6.  
  7.                 mail            : request.body.email,
  8.                 password    : hashString(request.body.password)
  9.             }
  10.  
  11.  
  12.             usersCollection.insert(newUser, function (err,doc) {
  13.  
  14.                 if (err) throw err;
  15.  
  16.                 response.send(JSON.stringify(doc))
  17.             })         
  18.  
  19.         })
  20.  
  21.  
  22. var hashString = function(string) {
  23.     return crypto.createHash('sha256').update(string).digest('base64')
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement