流星铁路由器RegEx

时间:2015-08-19 22:59:24

标签: regex node.js url meteor iron-router

我在 Meteor 应用上使用铁路径,我想知道使用正则表达式来定义路径路径是可能?

目前,我定义了这样的路径:

path: '/article/:slug-:_id'

但Iron路由器找不到该页面,因为slug也包含破折号......所以Iron路由器不知道如何识别slugid

是否有更精确定义路径的解决方案?就像在Symfony或Spring等中一样:

@Route("/article/{id}-{slug}", requirements={"id"="([0-9]+)", "slug"="([a-z0-9\-]+)"}, name="article_view")

非常感谢!
雅尼斯。

0 个答案:

没有答案