Reversing fastapi routes #374
devxpy
announced in
Programming Guide
Replies: 2 comments 2 replies
-
PS we use this extensively to build recipe URLs https://github.com/dara-network/ddgai/blob/e7b69bc815eb0ea79dcd9db7bf1262d3b1bb422f/routers/root.py#L729 |
Beta Was this translation helpful? Give feedback.
0 replies
-
do you have something in mind for when this will run into a circular import? e.g. when we define the routes in a parent a common use case would be to redirect to another route. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Whenever you want to refer to a server url in code, reverse route fn to URLs / Paths using
get_route_url()
andget_path_url()
Avoid hardcoding the url paths
Beta Was this translation helpful? Give feedback.
All reactions