#tonic #hyper #web-services #multiplex #routes #requests #multiplexer

multiplex-tonic-hyper

Merge a gRPC service and other HTTP service into one service

1 unstable release

0.1.0 Sep 11, 2022

#14 in #multiplex

Download history 101/week @ 2023-12-11 91/week @ 2023-12-18 35/week @ 2023-12-25 137/week @ 2024-01-01 118/week @ 2024-01-08 96/week @ 2024-01-15 166/week @ 2024-01-22 151/week @ 2024-01-29 164/week @ 2024-02-05 131/week @ 2024-02-12 148/week @ 2024-02-19 116/week @ 2024-02-26 116/week @ 2024-03-04 141/week @ 2024-03-11 164/week @ 2024-03-18 161/week @ 2024-03-25

591 downloads per month

MIT license

20KB
375 lines

Multiplex tonic hyper

  • Note: This is the first crate I made. Just publishing to try crates.io

This implements a service that routes requests based on Content-Type. If starts with application/grpc it sends to the inner gRPC service. If it doesn't, then it sends to the other service.

Examples

Try the examples:

Open the server, them try the web service at http://[::1]:9999.

cargo run --example hello_world_server
cargo run --example hello_world_client

lib.rs:

Crate to route requests between a tonic gRPC service, and some other service

The [Multiplexer] struct implements Service<Request>, and routes requests based on the Content-Type header.

Dependencies

~5–7MB
~117K SLoC