Discussion Context
This issue tracks a discussion raised during review of PR #342 about modular routes and session access patterns.
Original Discussion: #342 (comment)
Summary
When using modular routes with injectIn() and handler functions (e.g., router.get('/', _handler)), developers need to work with plain functions rather than typed Route objects. This raises questions about:
-
Type Safety Concern: Why do modular routes require jumping out of the typed world just to group related endpoints?
-
Route Composition: Should there be a Serverpod typed version that allows adding existing Route objects to a module route group?
-
Session Access Pattern: The current pattern involves handler functions that cannot override call to retrieve the session like Route (which is a HandlerObject) does.
Discussion Points
- Handler functions are just functions, not handler objects with session parameter injection
- Potential solutions mentioned:
- Wrapping functions as Route objects
- Using ContextProperty for session access
Requested By
@nielsenko
Related
Discussion Context
This issue tracks a discussion raised during review of PR #342 about modular routes and session access patterns.
Original Discussion: #342 (comment)
Summary
When using modular routes with
injectIn()and handler functions (e.g.,router.get('/', _handler)), developers need to work with plain functions rather than typed Route objects. This raises questions about:Type Safety Concern: Why do modular routes require jumping out of the typed world just to group related endpoints?
Route Composition: Should there be a Serverpod typed version that allows adding existing
Routeobjects to a module route group?Session Access Pattern: The current pattern involves handler functions that cannot override
callto retrieve the session likeRoute(which is aHandlerObject) does.Discussion Points
Requested By
@nielsenko
Related