嘿伙计们,我是一个刚刚开始研究 nodejs 的菜鸟。我正在使用 Compoundjs 在 nodejs 上开发一个 Web 应用程序。
这是我的视图文件夹的结构
views/
|-- admin
| |-- games
| |-- squadplayertypes
| `-- toursection
| |-- tourformats
| |-- tourmatchtypes
| `-- tours
|-- layouts
| |-- admin
| | `-- toursection
我创建了一个名称空间来处理所有指向“/admin”的请求。
现在我想知道是否有可以为命名空间“admin”内的所有路由定义公共布局的地方。
这就是我编写 routes.js 的方式
admin.namespace('toursection', function(toursection){
toursection.resources('tours',function(tour){
tour.post('fetchTourDetails','tours#fetchTourDetails',{collection:true});
});
toursection.resources('tourmatchtypes');
toursection.resources('tourformats');
});
/*Routes for squad players and all related dependancies*/
admin.resources('squadplayers');