refactor: shorter middleware

isekai-main
Barış Soner Uşaklı 3 years ago
parent b2429ef00e
commit ee0282f5aa

@ -16,15 +16,8 @@ let loginStrategies = [];
const Auth = module.exports;
Auth.initialize = function (app, middleware) {
const passportInitMiddleware = passport.initialize();
app.use((req, res, next) => {
passportInitMiddleware(req, res, next);
});
const passportSessionMiddleware = passport.session();
app.use((req, res, next) => {
passportSessionMiddleware(req, res, next);
});
app.use(passport.initialize());
app.use(passport.session());
app.use((req, res, next) => {
Auth.setAuthVars(req, res);
next();

@ -148,15 +148,8 @@ function setupExpressApp(app) {
configureBodyParser(app);
app.use(cookieParser(nconf.get('secret')));
const userAgentMiddleware = useragent.express();
app.use((req, res, next) => {
userAgentMiddleware(req, res, next);
});
const spiderDetectorMiddleware = detector.middleware();
app.use((req, res, next) => {
spiderDetectorMiddleware(req, res, next);
});
app.use(useragent.express());
app.use(detector.middleware());
app.use(session({
store: db.sessionStore,
secret: nconf.get('secret'),

Loading…
Cancel
Save