var user =  db.User.find({ where: { username: username }}).then(function(user) {
      console.log("Authenticate"+user.authenticate(password));
      if (!user) {
        return null;
      } else if (!user.authenticate(password)) {
          return null;
      } else {
       return user;
      }
    }).catch(function(err){
      return err;
    });
I am Using Sequelize JS with Node JS. I want the object of the user that matches the where clause. but when I do return from then function . but it goes into infinite loop. I am new to Node Js and I don't know how to use Promise in Node Js. Please help mee