You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When declaring a dynamic route, they will always take precedence over a non dynamic on. For example, imagine that I have the following route:
GET /turtles/[id]
And the following:
POST /turtles/random
When calling curl -X POST http://localhost:8080/turtles/random, routes/turtles/[id]/index.dart will be called instead of routes/turtles/random.dart, which can be confusing.
I understand that this can be considered an expected behaviour, one could argue that random is simply an id that the index.dart inside the /turtles/[id]/folder should consider and handle. Which I completely agree, but on the other hand,random.dartand[id]/index.dart` files are conflicting routes.
I believe there are two possible ways of fixing this:
Non dynamic routes should take precedence over dynamic ones, so we could check for non dynamic route handlers before checking in dynamics ones, that way the example above would work. I believe this to be a preferred way of handling this, being able to split handlers like this can lead to a more organized route structure where we would be able to better split similar routes in different files.
Identify these conflicts and give a warning to the user
The text was updated successfully, but these errors were encountered:
Description
When declaring a dynamic route, they will always take precedence over a non dynamic on. For example, imagine that I have the following route:
GET /turtles/[id]
And the following:
POST /turtles/random
When calling
curl -X POST http://localhost:8080/turtles/random
,routes/turtles/[id]/index.dart
will be called instead ofroutes/turtles/random.dart
, which can be confusing.Steps To Reproduce
curl -X POST http://localhost:8080/turtles/random
Expected Behavior
I understand that this can be considered an expected behaviour, one could argue that
random
is simply anid
that theindex.dart
inside the /turtles/[id]/folder should consider and handle. Which I completely agree, but on the other hand,
random.dartand
[id]/index.dart` files are conflicting routes.I believe there are two possible ways of fixing this:
The text was updated successfully, but these errors were encountered: