Meteorjs Iron Router:Router.current 不是 [object object] 处的函数

Meteorjs Iron Router: Router.current is not a function at [object object]

我 运行 在尝试检索我在下面的代码中拥有的 Routers 路由名称时,我遇到了一个可能很简单的问题。当语句 Router.current() 执行时 returns 返回一个空对象,即使我已经在我的路由中指定了名称。有人知道我在这里可能做错了什么吗?

这个文件被加载到我的 /lib/ 目录中

Router.route( '/webservices', { name: 'webservices', where: "server" } )
      .get( function() {
        var res = this.response;
        var routeName = Router.current().route.getName();
        clientIp = this.request.connection.remoteAddress;

        console.log(clientIp+' '+routeName);

        res.end('NGA Web Services are Online!');

      });

错误代码:

TypeError: Router.current is not a function at [object Object]. (app/lib/routes/webservice.js:4:25) at boundNext (packages/iron_middleware-stack/lib/middleware_stack.js:251:1) at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1) at packages/meteor/dynamics_nodejs.js:123:1 at [object Object].urlencodedParser (/home/v601756/.meteor/packages/iron_router/.1.0.13.1922hfs++os+web.browser+web.cordova/npm/node_modules/body-parser/lib/types/urlencoded.js:84:40) at packages/iron_router/lib/router.js:277:1 at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1) at [object Object].hookWithOptions (packages/iron_router/lib/router.js:276:1) at boundNext (packages/iron_middleware-stack/lib/middleware_stack.js:251:1) at runWithEnvironment (packages/meteor/dynamics_nodejs.js:110:1) 

Iron Router 在 doc

上提到了这一行

"If you're on the client, you can use the Router.current() method."

所以你不能访问服务器端的Router.current。