Doubt and error about using axum and tonic together #1983
-
I'm trying to create a little Grpc-Web Rust server using I'm new both to Rust and Grpc. I managed to generate all the rust code from proto files. THE REPOSITORY IS HERE: https://github.com/frederikhors/issue-tonic-web The issue I'm having is when I try to create the grpc server inside another function. What should I use here? https://github.com/frederikhors/issue-tonic-web/blob/main/src/routes/grpc.rs#L51 pub fn new_grpc_server() -> Router {
// I need to expose these services as grpc-web (using tonic_web I think)
// let server = tonic_web::enable(GreeterServer::new(GrpcServiceImpl::default()));
let server = tonic::transport::Server::builder()
.add_service(HelloGreeterServer::new(HelloServiceImpl::default()))
.add_service(WorldGreeterServer::new(WorldServiceImpl::default()));
server
} Issues
I can also PR adding an example in axum repo for this as soon I understand how to do. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Like my other example you need to use |
Beta Was this translation helpful? Give feedback.
Like my other example you need to use
HandleErrorLayer