I have several routes, and I need Facebook authentication only in the routes that start with /admin
:
app.get('/admin/dashboard', passport.ensureAuthenticated, .....);
app.get('/admin/dashboard/new/email', passport.ensureAuthenticated, ....);
app.get('/admin/dashboard/new/question', passport.ensureAuthenticated, ....);
app.get('/admin/dashboard/new/answer', passport.ensureAuthenticated, ....);
app.get('/admin/dashboard/new/etc', passport.ensureAuthenticated, ....);
If I can't use the app.use
, is there anyone to call passport.ensureAuthenticated
repetition in routes that start with /admin
?