📅  最后修改于: 2022-03-11 15:03:40.803000             🧑  作者: Mango
its because you have declared the middleware after you have intialised the routes
in the index file
the correct order is
app.use(passport.initialize());
app.use(passport.session());
app.use(passport.setAuthenticatedUser);
app.use('/', require('./routes'));