-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed resource id when multiple segments are present. Closes #36
- Loading branch information
Showing
3 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
exports.index = function(req, res){ | ||
res.send('list of cats'); | ||
}; | ||
|
||
exports.new = function(req, res){ | ||
res.send('new cat'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit 60746f6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix, actually breaks applications where you have several routes that finish with the same name such as /admin/items, /user/items since the functions that generates the ID is only considering the last keyword after the slash.
This breaks setups like this:
/admin/items (rest resource where you can edit everything)
/user/items (rest where you can read only items from a user)
There will be 2 duplicate ids 'item' that will colide and always the last one defined will be used in the routes.