Answer the question
In order to leave comments, you need to log in
How to connect sequalize to a project and display data from mysql?
Good afternoon. Please help me integrate sequalize into the project. Now I am authenticating and I am comparing the data with the userDB object.
For authentication I use passport.js
const userDB = {
id: 1,
email: "[email protected]",
password: "123"
}
passport.serializeUser(function(user, done) {
console.log("Serialize: ", user);
done(null, user.id);
});
passport.deserializeUser(function(id, done) {
/*User.findById(id, function(err, user) {
done(err, user);
});*/
console.log("Deserialize: ", id);
user = (userDB.id === id) ? userDB : false;
done(null, user);
});
passport.use(new LocalStrategy(
{usernameField: 'email'},
function(email, password, done) {
if(email === userDB.email && password === userDB.password) {
return done(null,userDB)
}
else {
return done(null,false)
}
})
);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question