Support for custom HTTP routes when using gRPC
Closed this issue · 3 comments
Hi,
In GrpcService routes are dynamically generated from the gRPC definition. When I try to use this HTTP client the url has to be /grpc.hello.HelloService/Hello
which is not very friendly. It would be great addition if I can provide custom routes, example /Hello
would make it easy for any HTTP Client.
I had discussed this briefly with @kowshikn and just want to clarify, this is for supporting unframed gRPC together with normal - normal gRPC naturally needs to be at it's normal paths for use from gRPC clients while unframed could be set to a more HTTP idiomatic path.
Hi, @kowshikn and @anuraaga. Thanks for the feature request. Would it be enough to allow specifying a custom path
for each gRPC service? e.g.
Server.builder()
.service(GrpcService.builder()
.addService(fooService)
.addService(barService)
.enableUnframedRequests(false)
.build())
.service(GrpcService.builder()
.addService("/foo", fooService)
.addService("/bar", barService)
.enableUnframedRequests(true)
.build())
.build();
Yeah I think that's reasonable :) Another idea I had was setting a mapping of path to MethodDescriptor
in GrpcService
. Since we convert from mapped path to method descriptor based on the DSL right now might be simpler to just allow adding a way to do a custom mapping at that point.