Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var User = require('./app/models/user');
  2.  
  3. // create a new user called chris
  4. var chris = new User({
  5.   name: 'Chris',
  6.   username: 'sevilayha',
  7.   password: 'password'
  8. });
  9.  
  10. // call the custom method. this will just add -dude to his name
  11. // user will now be Chris-dude
  12. chris.dudify(function(err, name) {
  13.   if (err) throw err;
  14.  
  15.   console.log('Your new name is ' + name);
  16. });
  17.  
  18. // call the built-in save method to save to the database
  19. chris.save(function(err) {
  20.   if (err) throw err;
  21.  
  22.   console.log('User saved successfully!');
  23. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement