Route priorities
See original GitHub issueHi, in my project I along with route path like /welcome
, /sign_in
(specific string matched) I have also path /:id
. I’ve found only way to match this route is to place it on top of routes
so it looks like:
const routes = [
{ path: '/:id', name: 'idRoute' },
{ path: '/welcome', name: 'welcome' },
{ path: '/sign_in', name: 'signIn' }
];
And it seems kind of strange for routes to be resolved bottom->top, wouldn’t it make more sense to go top->bottom? So it checks all routes first and if none matches then it comes to /:id
?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Route Precedence -- How does a Router choose its preferred ...
The three attributes for Route Preference are the Route Specificity, the Administrative Distance, and the Metric. If multiple routes exist and ...
Read more >Configure Route Selection for Routers - Cisco
This document describes how routers work, are configured, and how to select a route for them.
Read more >Linux for Network Engineers: How to Set Route Priorities
In this Linux for Network Engineers post, learn how to set and prioritize a route on Linux.
Read more >Route Prioritizing - SonicWall Online Help
Traditionally, routes have been prioritized based on the specificity of the destination IP address. Routes with longer prefixes (more specific) have a higher ......
Read more >ip route priority high — router - Cisco IOS in a Nutshell, 2nd ...
This command assigns a high priority to an IS-IS prefix, which means routes with the specified tag are marked for faster processing and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, because the
action
method of a route will have to return anything different fromundefined
to stop iterating and finish routing process.Playground: https://jsfiddle.net/frenzzy/ko22k9cg/1/
The ordering works the same way as in express. So
:id
param matches everything and next route will not be called. Playground: https://jsfiddle.net/frenzzy/ko22k9cg/