【问题标题】:express how to make the route catch prefix表达如何使路由捕获前缀
【发布时间】:2013-05-31 13:18:35
【问题描述】:

我正在使用带有 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#_=_

(由于某些未知原因,此路由无法捕获 url)

【问题讨论】:

    标签: node.js express routes


    【解决方案1】:

    使用正则表达式

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

    【讨论】:

      猜你喜欢
      • 2015-09-22
      • 2019-04-04
      • 2019-12-11
      • 1970-01-01
      • 1970-01-01
      • 2015-12-10
      • 2011-06-09
      • 2013-10-09
      • 1970-01-01
      相关资源
      最近更新 更多