text: // Using https://blog.cloudboost.io/node-js-authentication-with-passport-4a125f264cd4 as a resource
  const passport = require("passport")
  const LocalStrategy = require("passport-local").Strategy
  
  const local = new LocalStrategy((username, password, done) => {
    User.findOne({ username })
      .then(user => {
        if (!user || !user.validPassword(password)) {
          done(null, false, { message: "Invalid username/password" });
        } else {
          done(null, user);
        }
      })
      .catch(e => done(e));
  });
  passport.use("local", local);
  
  // from the passport documentation:
  // passport.use(new LocalStrategy(
  //     function(username, password, done) {
  //       User.findOne({ username }, function (err, user) {
  //         if (err) { return done(err); }
  //         if (!user) { return done(null, false); }
  //         if (!user.verifyPassword(password)) { return done(null, false); }
  //         return done(null, user);
  //       });
  //     }
  //   ));
  
  module.exports = local