Naming routes #2177
-
Hi there, quick question. In actix you can set names for your routes e.q .service(
web::resource("/about")
.route(web::get().to(about))
.name("about"),
) that you can retrieve on the request with: request.url_for_static(route_name) I know such a feature also exists in like django (python). The reason for it, is that i would like to give my routes a name and not hardcode the url everywhere. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
There is nothing similar in axum, but axum-extra provides the |
Beta Was this translation helpful? Give feedback.
-
No axum doesn’t have such a feature. So you have to handle that yourself. You can also use https://docs.rs/axum-extra/0.7.7/axum_extra/routing/trait.TypedPath.html from axum-extra |
Beta Was this translation helpful? Give feedback.
There are no plans to add something like this to axum itself.