You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there! I was wondering if it’d be possible to integrate a more poetic way of nesting/merging routes in Poem. Something that feels intuitive and makes people feel right at home. For example, in web servers like FastAPI, there’s an add_router method that lets you nest routers and makes modularizing the codebase super smooth. I know you can already do this in Poem with .nest("", another_router_object), but honestly, it doesn’t feel very poetic.
So, maybe we could add something like nest_router as an alias or helper method for nest to improve the developer experience? Let me know if I’m missing something here. If this idea is supported, I’d love to open a PR and contribute!. 🚀 🤠
Code example (if possible)
Current approach
/// code somewhere over the rainbowlet v1_router = Route::new().nest("api/v1",{Route::new().nest("", another_router_somewhere)})/// mainlet app = Route::new().nest("", v1_router);
Proposed API
/// code somewhere over the rainbowlet v1_router = Route::new().nest("api/v1",{Route::new().nest_router(another_router_somewhere)})/// mainlet app = Route::new().nest_router(v1_router);
I think we can even streamline the route prefix thing a little bit
/// code somewhere over the rainbowlet v1_router = Route::new().prefix("api/v1").nest_router(another_router_somewhere).nest_router(another_router_somewhere2).nest_router(another_router_somewhere3)/// mainlet app = Route::new().nest_router(v1_router);
The text was updated successfully, but these errors were encountered:
Description of the feature
Hey there! I was wondering if it’d be possible to integrate a more poetic way of nesting/merging routes in Poem. Something that feels intuitive and makes people feel right at home. For example, in web servers like FastAPI, there’s an add_router method that lets you nest routers and makes modularizing the codebase super smooth. I know you can already do this in Poem with .nest("", another_router_object), but honestly, it doesn’t feel very poetic.
So, maybe we could add something like nest_router as an alias or helper method for nest to improve the developer experience? Let me know if I’m missing something here. If this idea is supported, I’d love to open a PR and contribute!. 🚀 🤠
Code example (if possible)
Current approach
Proposed API
I think we can even streamline the route prefix thing a little bit
The text was updated successfully, but these errors were encountered: