I\'m using Sequelize
as ORM. Here\'s my user model:
###
User model
###
User = exports.User = globals.sequelize.define \"User\",
usernam
sequelize will pass the error as the paramater to the error function.
JavaScript:
User.findOrCreate({username: "johny",password: "pass",email: "johny93[###]example.com"})
.success(function(user, created){
console.log(user.values);
res.send(200);
})
.error(function(err){
console.log('Error occured' + err);
})
CoffeScript:
globals.models.User.findOrCreate
username: "johny"
password: "pass"
email: "johny93[###]example.com"
.success (user, created)->
console.log user.values
res.send 200
.error (error)->
console.log error # how to catch this?
res.send 502