-
-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC for router enhancements #154
Closed
Closed
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b86aeb9
RFC for router enhancements
cibernox 1849f2e
Auto-review typos
cibernox f331571
Apply feedback
cibernox e1da7a7
More typos, add syntax highlighting and improve wording
cibernox c6c0e3a
Simplify constrains spec
cibernox 53cd755
Parentheses only wrap the segment, not the slashes
cibernox b6416b9
Edit for clarity.
nathanhammond cb4ab4b
Merge pull request #2 from nathanhammond/router_enhancements_tweaks
cibernox d5a9a0a
Add example of conficting routes resolution
cibernox 9d1d1dd
Add one more example
cibernox ce77794
Fix latest example
cibernox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,9 @@ Router.map(function() { | |
this.route('sample1', { path: '/foo/bar' }); | ||
this.route('sample2', { path: '/foo/(:param)' }); | ||
this.route('sample3', { path: '/foo/*path' }); | ||
this.route('sample4', { path: '/foo' } ,function() { | ||
this.route('opt', { path: '/(:param)' }); | ||
}); | ||
}); | ||
``` | ||
|
||
|
@@ -110,15 +113,16 @@ The resolution order stays as it is currently. That is | |
- Greater number of segments means more specific. | ||
- On the same number of segments, static is more specific than dynamic, and dynamic is more specific | ||
than globs. | ||
- In case of tie, the first defined route wins | ||
- In case of tie in the number and type of segments, the route with more handlers wins. | ||
- If all the previous fail, the first defined route wins | ||
|
||
Examples: | ||
|
||
``` | ||
/foo/bar => 'sample1' (two segments, both static) | ||
/foo/dynamic => 'sample2' (two segments, one static, one dynamic) | ||
/foo/something/else => 'sample3' (two segments, one static, one glob) | ||
/foo => 'sample2' (one static segment) | ||
/foo => 'sample4' (one static segment, but wins over sample 2 because has more handlers) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be |
||
``` | ||
|
||
### Dynamic Segment Constraints | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 would be
sample4.opt
because it has more handlers.