generated from go-masonry/mortar-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
http.go
34 lines (30 loc) · 1.08 KB
/
http.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package mortar
import (
"github.com/go-masonry/mortar/providers"
"go.uber.org/fx"
)
func HttpClientFxOptions() fx.Option {
return fx.Options(
providers.HTTPClientBuildersFxOption(), // client builders
providers.TracerGRPCClientInterceptorFxOption(),
providers.TracerRESTClientInterceptorFxOption(),
providers.CopyGRPCHeadersClientInterceptorFxOption(),
)
}
func HttpServerFxOptions() fx.Option {
return fx.Options(
providers.HTTPServerBuilderFxOption(), // Web Server Builder
providers.GRPCTracingUnaryServerInterceptorFxOption(),
providers.GRPCGatewayMetadataTraceCarrierFxOption(), // read it's documentation to understand better
providers.LoggerGRPCInterceptorFxOption(), // Log every gRPC request and response
providers.MonitorGRPCInterceptorFxOption(),
)
}
// These will help you to debug/profile or understand the internals of your service
func InternalHttpHandlersFxOptions() fx.Option {
return fx.Options(
providers.InternalDebugHandlersFxOption(),
providers.InternalProfileHandlerFunctionsFxOption(),
providers.InternalSelfHandlersFxOption(),
)
}