javascript - Pass a route segment as callback argument -
javascript - Pass a route segment as callback argument -
i'm building first app in express. possible somehow pass route segment argument callback?
app.get('/connect/:mysegment', mycallback(mysegment));
specifically, i'm using passport several strategies authentication. rather doing,
app.get('/connect/twitter', passport.authorize('twitter') ); app.get('/connect/facebook', passport.authorize('facebook') );
i along lines of...
app.get('/connect/:service', passport.authorize(service));
of course, can do
app.get('/connect/:mysegment', function(req, res){ // can utilize req.params.mysegment });
javascript node.js express
Comments
Post a Comment