【发布时间】:2014-07-17 18:36:06
【问题描述】:
对于仅服务器路由,如何获取当前用户。
请注意,这条路线看起来像:
this.route('report_access', {
path: '/report/:humanId?/:reportKey',
where: 'server',
action: ....
});
这不在发布或方法调用中,因此 Meteor.user() / Meteor.userId() 失败。
我查看了 route.params 并没有设置用户 ID。
【问题讨论】:
-
为什么要这样做?非客户端用户何时会调用服务器端路由?
-
很多情况:1) 加书签的 url,2) 来自外部服务的 302 次反弹重定向,3) 或 .... 仅在服务器上处理的 Iron-router 路由
标签: meteor iron-router