Skip to main content
added 3 characters in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237

How to use Using app.use only in routes that start with /admin?

I have several routes, and iI need facebookFacebook 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 iI can't use the app.useapp.use, there is there anyone to call passport.ensureAuthenticatedpassport.ensureAuthenticated repetition in routes that start with /admin?

How to use app.use only in routes that start with /admin?

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, there is anyone to call passport.ensureAuthenticated repetition in routes that start with /admin?

Using app.use only in routes that start with /admin

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?

Source Link
user63272
user63272

How to use app.use only in routes that start with /admin?

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, there is anyone to call passport.ensureAuthenticated repetition in routes that start with /admin?