middleware.js
359 Bytes
const isLoggedIn = (req, res, next) => {
if (req.isAuthenticated()) {
next();
} else {
res.redirect('/');
}
};
let isNotLoggedIn = (req, res, next) => {
if (!req.isAuthenticated()) {
next();
} else {
res.redirect('/');
}
};
module.exports = {
isLoggedIn,
isNotLoggedIn,
};