Replies: 4 comments 2 replies
-
@davidfowl PTAL and share your thoughts here (I think you checked such approaches before when IIRC). |
Beta Was this translation helpful? Give feedback.
-
@gfoidl @davidfowl I vibe-coded a quick prototype here : https://github.com/divyeshio/FileBasedRouting. It works as following :
Note : This works only for non-AOT scenarios because RDG kicks in AOT mode and since we can't chain source generators this gives runtime exceptions in those cases. @captainsafia Any thoughts on this? |
Beta Was this translation helpful? Give feedback.
-
I'm not a fan of file based routing. Razor pages and Blazor components let you define the route at the top of the file. That scales better as the routing syntax doesn't need to be reverse engineered from riles on disk nor do you need an alernative way to describe things that already can be described using the existing syntax. |
Beta Was this translation helpful? Give feedback.
-
I'm actually a bit of a fan of file-based routing and enjoyed using it from back when I was building more things with Next.JS. @davidfowl's comment about it not scaling well because there's only so much of a routing system that you can replicate on disk is spot on, but I find this constraint actually better for helping people structure more sensible APIs.
There's no elegant way around this at the moment, although I do have some ideas about restructuring the way we do endpoint discovery and RequestDelegate construction in minimal APIs that should make hookups like this much more feasible in the future. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Starting a new project with minimal apis is great experience, but as projects grows apis require structuring. Wouldn't it be great if the structure of the files/folders depicted the routes. Frameworks like Next.js and Tanstack already have this feature. And it is a great experience indeed. Was wondering if we could have something similar in .Net, it would make the DX even better.
Some addtional features :
Beta Was this translation helpful? Give feedback.
All reactions