Router matching multiple routes to controllers
- 主要言語
- JavaScript
- スター
- 1.6k
- フォーク
- 179
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I have the following routes defined:
``` javascript
exports.routes = function (map) {
map.all('admin/:controller/:action');
map.all('admin/:controller/:action/:id');
map.all(':controller/:action');
map.all(':controller/:action/:id');
};
```
When I visit /admin/mycontroller/index, I see in my console that compound is trying to access both:
```
Params: {"controller":"mycontroller","action":"index"} // this is correct
Params: {"controller":"admin","action":"mycontroller","id":"index"}
```
But I was expecting only the first to be routed. Is this a bug? Yes, both routes are valid, but only one is supposed to be executed, not every matching route.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Look at the router implementation in the compound framework, likely in a file like lib/router.js. The issue shows that multiple route patterns are being matched when only one should be. Start by understanding how the map.all method works and how route precedence is determined. Test by creating a simple app with the given routes and logging the matching logic to see why both are triggered.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, node.js
- 領域
- api, backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100