Elaborate more on the route priority order#3374
Conversation
✅ Deploy Preview for astro-docs-2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
| 1- Routes without path parameters | ||
| - Endpoints without path parameters take precedence over all other routes | ||
| - Routes without path parameters take precedence over dynamic routes | ||
|
|
||
| - Static routes without path parameters will take precedence over all other routes | ||
| - Dynamic routes using named parameters take precedence over rest parameters | ||
| 2- Dynamic routes with path parameters | ||
| - Static endpoints using named parameters take precedence over other static routes | ||
| - Static routes using named parameters take precedence over server endpoints using named parameters | ||
| - Server endpoints using named parameters take precedence over server routes using named parameters | ||
| - Server routes using named parameters take precedence over other routes using rest parameters | ||
|
|
||
| 3- Dynamic routes with rest parameters | ||
| - Rest parameters have the lowest priority | ||
| - Ties are resolved alphabetically | ||
| - Static endpoints using rest parameters take precedence over other static routes using rest parameters | ||
| - Static routes using rest parameters take precedence over server endpoints using rest parameters | ||
| - Server endpoints using rest parameters take precedence over server routes using rest parameters | ||
| - Server routes using rest parameters take precedence over other routes using rest parameters |
There was a problem hiding this comment.
I wonder if it would be a good idea to create a priority queue or a pyramid component to represent these different cases, I feel like this is a bit hard to follow 😅
|
Sorry, I'm still not at the stage of really editing this yet, but clarifying question: This is now a lot more words to read, and I think really all it's saying new is that in every case, endpoints take priority over routes? Maybe we just need a sentence that says that somewhere, and it applies everywhere? |
|
Yes that, and also prerendered routes take precedence over server routes in dynamic routes (rest and named). |
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
sarah11918
left a comment
There was a problem hiding this comment.
Looks great to me! Thanks for this! 🚀
What kind of changes does this PR include?
Description
The current route priority order section lacks some info. For example, endpoints always take precedence in their route category, and prerendered routes always take precedence over server routes. This PR adds more about all that.