-
I'd like to use a pattern where nested from starlette.applications import Starlette
from starlette.routing import Route, Mount
routes = [
Mount(
"/api",
routes=[
Route("/foos", list_foos),
Mount(
"/foo/{foo_id:uuid}",
routes=[
Route("/bars", list_bars),
Route("/bar/{bar_id:uuid}", get_bar),
Route("/quuxs", list_quuxs),
Route("/quux/{quux_id:uuid}", get_quux),
Route("/quux/{quux_id:uuid}/bazs", list_bazs),
Mount(
"/monitoring",
routes=[
Mount(
"/bar/{bar_id:uuid}",
routes=[
Route("/overview", get_overview),
Route("/quuxs", list_quuxs_monitoring),
Route("/bazs", list_bazs_monitoring),
],
),
],
),
],
middleware=[Middleware(FooMiddleware)],
),
Route("/support", get_support),
],
middleware=[
Middleware(APIMiddleware1),
],
)
]
app = Starlette(routes=routes, debug=True) Serving this app, I tried something similar using the lower-level Am I missing something? Note: I stumbled upon this thread and this one but they don't seem related to my issue. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I managed to make it work... It seems like the problem comes from the
So the problem is not what I thought it was: it's just that the UUID default convertor is a bit too zealous (to my taste at least 😛 ) and does not accept a formatting stripped from hyphens. The actual nested/mounts works as intended. Sorry for the noise. |
Beta Was this translation helpful? Give feedback.
ok! Done here #2806