func main() { go grpcServer() conn, err := grpc.Dial("localhost:8675", grpc.WithInsecure()) if err != nil { glog.Fatal(err) } cli := foo.NewFooServiceClient(conn) mux, err := foo.MakeMux_FooService(cli, noMiddleware, jsonEncoder) if err != nil { glog.Fatal(err) } http.ListenAndServe("localhost:8000", mux) }
func main() { go grpcServer() ctx := context.Background() conn, err := grpc.Dial("localhost:8675", grpc.WithInsecure()) if err != nil { glog.Fatal(err) } cli := foo.NewFooServiceClient(conn) http.ListenAndServe("localhost:8000", foo.MakeMux_FooService(cli, kithttp.Server{ Context: ctx, Logger: log.NewLogfmtLogger(os.Stderr), EncodeResponseFunc: func(wr http.ResponseWriter, data interface{}) error { return json.NewEncoder(wr).Encode(data) }, })) }