Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace HasRoutes with Into<Router> #819

Merged
merged 3 commits into from
Mar 3, 2022
Merged

Conversation

davidpdrsn
Copy link
Member

I think HasRoutes in axum-extra is pretty neat. It allows users to build their own abstractions for building routes and have them work directly with axum. I've been thinking that for 0.5 we should promote the trait to live in axum.

This is partly driven by some talks @LucioFranco and I have been having about possibly moving tonic's routing to axum in a more public way. Tonic currently reinvents a bunch of middleware stuff that axum already handles. That'd also give users more flexibility in how they compose their gRPC services. Such a change could have tonic implement HasRoutes for its services so they'd work with axum::Router::merge. However there are no concrete plans so its mostly speculation on my part.

I don't see much downside to this. Router implements HasRoutes so everything works like it used to.

@jplatte what do you think?

axum/src/routing/mod.rs Outdated Show resolved Hide resolved
@davidpdrsn davidpdrsn requested a review from jplatte March 3, 2022 14:01
@davidpdrsn davidpdrsn added this to the 0.5 milestone Mar 3, 2022
Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@davidpdrsn davidpdrsn enabled auto-merge (squash) March 3, 2022 21:44
@davidpdrsn davidpdrsn disabled auto-merge March 3, 2022 21:46
@davidpdrsn davidpdrsn enabled auto-merge (squash) March 3, 2022 21:47
@davidpdrsn davidpdrsn merged commit d943ba6 into main Mar 3, 2022
@davidpdrsn davidpdrsn deleted the move-has-routes-into-axum branch March 3, 2022 21:50
@davidpdrsn davidpdrsn changed the title Move HasRoutes into axum Replace HasRoutes with Into<Router> Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants