()
| 44 | } |
| 45 | |
| 46 | func Example_handler() { |
| 47 | // protoc-gen-triple-go generates constructors that return plain net/http |
| 48 | // Handlers, so they're compatible with most Go HTTP routers and middleware |
| 49 | // (for example, net/http's StripPrefix). Each handler automatically supports |
| 50 | // the Connect, gRPC, and gRPC-Web protocols. |
| 51 | mux := http.NewServeMux() |
| 52 | mux.Handle( |
| 53 | pingv1connect.NewPingServiceHandler( |
| 54 | &ExamplePingServer{}, // our business logic |
| 55 | ), |
| 56 | ) |
| 57 | // You can serve gRPC's health and server reflection APIs using |
| 58 | // github.com/bufbuild/triple-grpchealth-go and |
| 59 | // github.com/bufbuild/triple-grpcreflect-go. |
| 60 | _ = http.ListenAndServeTLS( |
| 61 | "localhost:8080", |
| 62 | "internal/testdata/server.crt", |
| 63 | "internal/testdata/server.key", |
| 64 | mux, |
| 65 | ) |
| 66 | // To serve HTTP/2 requests without TLS (as many gRPC clients expect), import |
| 67 | // golang.org/x/net/http2/h2c and golang.org/x/net/http2 and change to: |
| 68 | // _ = http.ListenAndServe( |
| 69 | // "localhost:8080", |
| 70 | // h2c.NewHandler(mux, &http2.Server{}), |
| 71 | // ) |
| 72 | } |
nothing calls this directly
no test coverage detected