programatik29 / axum-server

High level server designed to be used with axum framework.
MIT License
168 stars 56 forks source link

Document how to use a `Service` factory for `Server::serve()` #52

Closed daxpedda closed 1 year ago

daxpedda commented 1 year ago

I would like to wrap a user supplied app, like a Router, for that purpose I would like to use ServiceBuilder.

The issue is that Server::serve() needs a service factory, like what can be produced with Router::into_make_service(), which isn't available for ServiceBuilder.

The solution I found is wrapping it in Shared. I believe some documentation in axum-server would help.

See https://github.com/tokio-rs/axum/issues/1203 for the original problem.

programatik29 commented 1 year ago

I will add it for next release.

daxpedda commented 1 year ago

Added in https://github.com/programatik29/axum-server/commit/1a68546ed34ebd8f003c837855ca0101be32205.