dart_frog
dart_frog copied to clipboard
feat: having a router not file based
Description
I've tried playing a bit with dart_frog to migrate an existing nodeJS/express project of mine. The file based router might be nice and easy on paper or for small example. But I find it too permissive for real project.
Let me explain, problem with file as route is that the route will be called for each http methods event if you want only one, so you'll end up doing bunch of if/else to manage that but it is error prone where using a router define by code will let you define the http method supported.
The other problem I notice is for middleware, same is that if you want to apply it only to some http methods you'll also have to do bunch of if/else to manage that.
Requirements
- [ ] Provide a clear example on how to implement a non-file-based router
- [ ] Provide references in Routing/Middleware/Custom Server Entrypoint sections