表达如何使路由捕获前缀

时间:2013-05-31 13:18:35

标签: node.js express routes

我正在使用带有express的节点。我有以下路线:

app.get('/facebook/auth/callback', passport.authenticate('facebook', { failureRedirect: '/auth-failure' }, users.authSuccess));

如何使此路线匹配:

http://localhost:3000/facebook/auth/callback?error_code=2102&error_message=User+is+not+a+test+user+owned+by+the+application#_=_

(由于某些未知原因,此路线未捕获网址)

1 个答案:

答案 0 :(得分:0)

使用正则表达式

app.get('/facebook/auth/callback?*',passport.authenticate('facebook', { failureRedirect: '/auth-failure' }, users.authSuccess));
相关问题