0
module.exports = function routes() {
this.root('pages#main');
this.match('/status', 'pages#status');

this.resources('paper');
this.resources('tempform');
};

如何在我的应用程序中添加一个新的 url 假设“paper/domain”?

有人可以解释我如何添加这个吗?我已阅读机车指南,但无法找出解决方案。

4

2 回答 2

0

在机车路线中配置config/routes.js

this.match('pages/:home', { controller: 'PageController', action: 'show' });

然后在controllers目录中创建一个新文件

var PageController = new Controller();
module.exports = PageController;
PageController.show = function() {
  this.render();
}
于 2014-01-27T11:27:59.607 回答
0

来自 LocomotiveJS 指南: http: //locomotivejs.org/guide/namespaces/

您可以使用命名空间将多个控制器分组到一个命名空间下(例如 example.com/namespace/)。在你的情况下,你会想要类似的东西

this.namespace('paper', function() {
  this.match('domain', 'yourController#yourAction');
});
于 2014-03-18T10:52:48.917 回答