How to reuse Router? #100
-
Hi! I am trying to reuse the same router, since /v1 and /latest need to point to the v1 router. However, I am getting the typical Is there any way around this? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
chrislearn
Jul 16, 2022
Replies: 1 comment 1 reply
-
You can use function to create the router and call it twice. fn v1_router() -> Router {
Router::new().
....
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
2snEM6
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use function to create the router and call it twice.
Like this: