dart_frog icon indicating copy to clipboard operation
dart_frog copied to clipboard

feat: Route Groups

Open rubenferreira97 opened this issue 2 years ago • 0 comments

Description

With Route Groups it would be possible to prevent folders from being included in the route's URL path.

This feature would be useful for various use cases:

  • Enable nested middlewares in the same route segment level
  • Organizing routes into groups by feature, team, etc...

I propose adopting a syntax commonly used by other frameworks: (folder) Here are some examples:

routes
  (protected)
    _middleware.dart
    resource1.dart // localhost:8080/resource1, calls _middleware.dart
    resource2
      index.dart // localhost:8080/resource2, calls _middleware.dart
  (sales)
    form
      index.dart  // localhost:8080/form does not call _middleware.dart
  index.dart	// localhost:8080 does not call _middleware.dart

Additional Context I'm not entirely certain about the feasibility of this proposed feature and its implementation. I believe that introducing Route Groups could potentially address the mentioned use cases effectively. Many leading web development frameworks have embraced the concept of Route Groups to enhance code organization and overall routing flexibility.

rubenferreira97 avatar Aug 21 '23 21:08 rubenferreira97