Slide 25
Slide 25 text
25
grpc-gatewayの導入
// 対応するパスとHTTPハンドラが生成される
package proto
func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error {
mux.Handle("GET", pattern_EchoService_Echo_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
...
// 対応するgRPC Serviceのメソッドが呼び出される
resp, md, err := local_request_EchoService_Echo_1(rctx, inboundMarshaler, server, req, pathParams)
...
// gRPC Serviceのメソッド呼び出しの結果をリクエストとして返す
forward_EchoService_Echo_1(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
}