Documentation ¶
Overview ¶
Package serverutil provides helper functions to main.go files.
Index ¶
- func Healthz() http.HandlerFunc
- func ListenTLS(ctx context.Context, listenAddr, certFile, keyFile string) (net.Listener, *grpc.ClientConn, func(), error)
- func Readyz(db *sql.DB) http.HandlerFunc
- func RootHealthHandler(otherHandler http.Handler) http.HandlerFunc
- func ServeHTTPAPIAndGRPC(ctx context.Context, lis net.Listener, grpcServer *grpc.Server, ...) error
- func ServeHTTPMetrics(addr string, ready http.HandlerFunc) error
- type RegisterServiceFromConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Healthz ¶ added in v0.2.0
func Healthz() http.HandlerFunc
Healthz is a liveness handler that always responds with HTTP 200.
func ListenTLS ¶ added in v0.2.0
func ListenTLS(ctx context.Context, listenAddr, certFile, keyFile string) (net.Listener, *grpc.ClientConn, func(), error)
ListenTLS binds to listenAddr and returns a gRPC connection to it.
func RootHealthHandler ¶ added in v0.2.0
func RootHealthHandler(otherHandler http.Handler) http.HandlerFunc
RootHeaalthHandler handles liveness checks at "/". All other requests are passed through to `otherHandler`.
func ServeHTTPAPIAndGRPC ¶ added in v0.2.0
func ServeHTTPAPIAndGRPC(ctx context.Context, lis net.Listener, grpcServer *grpc.Server, conn *grpc.ClientConn, services ...RegisterServiceFromConn) error
ServeAPIGatewayAndGRPC serves the given services over HTTP / JSON and gRPC.
func ServeHTTPMetrics ¶ added in v0.2.0
func ServeHTTPMetrics(addr string, ready http.HandlerFunc) error
ServeHTTPMetrics serves monitoring APIs
Types ¶
type RegisterServiceFromConn ¶ added in v0.2.0
RegisterServiceFromConn registers services with a grpc server's ServeMux
Click to show internal directories.
Click to hide internal directories.