Replies: 1 comment 1 reply
-
I think the main / only reason nested fallbacks aren't supported is that matchit doesn't support having both a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed that, at least after #408, Axum doesn't allow having a
.nest
router that has a fallback (well as of 0.3.4 it's possible to add, but it never gets routed to-- because of #488 / #529 this looks like it will become a panic soon).We have a use case where having a nested fallback is useful, specifically we have a structure like this:
/v1
/swagger
/schema.json
→ Return fixed responseStaticDir
So, if
.nest()
could take aRouter
with a.fallback()
, then we could easily model the above. Without it, it would start to get messy. For now, we came up with the following simple workaround: usingservice_method_routing::any
to wrap theRouter
. Here's what it looks like in code:(Here's a full working example: https://github.com/kylewlacy/test-axum-nested-routing)
So there's the context basically. For purposes of discussion, here are 2 questions to start:
service_method_routing::any
to wrap a router intended? That is, can we rely on the above behavior indefinitely?Beta Was this translation helpful? Give feedback.
All reactions