✅ Flat route structure #2613
Replies: 5 comments
-
Object-based structure is for organizing and constraints, @williamgcampbell
But your suggestion on having alternative way to establish routing is interesting. I'll take a look on that. |
Beta Was this translation helpful? Give feedback.
-
Thanks! And yes, that all makes sense. Some of this comes from personal preference and size of the project, but I'll add that I've found the following to to be the case as I've used it more.
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
🚀 v23.4.0, @williamgcampbell |
Beta Was this translation helpful? Give feedback.
-
That was fast, thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is one part question, one part suggestion. I've never thought much about the nested route structure chosen by this repo until I tried to use an express-like flat structure andnwas met with an error from express-zod-api. Why commit so heavily to preventing users of the framework from using a flat structure? As the path gets more complex the nesting gets quite verbose. For example:
vs
There are certainly places where there can be a conflict between two routes when accepting a flat structured string but that can be handled quite easily by either accepting the first/last or rejecting altogether. I'm curious if there were any other considerations for the enforcement of a nested structure. Personally, I've been more inclined to write a converter from a structure like the one below, to the nested route structure in my projects.
Beta Was this translation helpful? Give feedback.
All reactions