re: Building a NodeJS Web App Using PassportJS for Authentication VIEW POST

TOP OF THREAD FULL DISCUSSION
re: i get this error with your code how do i fix this? models/users.js:36 User.hook("beforeCreate", function(user) { TypeError: User.hook is not a ...
 

How did you solve this, am getting a similar error

 

I think sequelize modified their doc. I had to do this

Users.beforeCreate(user => {
    user.password = bcrypt.hashSync(
      user.password,
      bcrypt.genSaltSync(10),
      null
    );
  });

before it worked. Check out the doc Hooks

code of conduct - report abuse