Documentation ¶
Overview ¶
Package httpx gateway.go contains two main API module: HTTP and gRPC. The reason for designing a gateway to serve request both HTTP and gRPC is that DO NOT want to listen on another TCP port so that client could build connections to only one server address.
This design referred: https://eddycjy.com/posts/go/grpc-gateway/2019-06-22-grpc-gateway-tls/
I hope them can help you too.
Index ¶
- func Logger() gin.HandlerFunc
- func NewGateway(addr string, s1 http.Handler, s2 *grpc.Server) *gateway
- func Recovery() gin.HandlerFunc
- func ResponseError(c *gin.Context, err error)
- func ResponseErrorAndAbort(c *gin.Context, err error)
- func ResponseErrorStatusAndAbort(c *gin.Context, status int, err error)
- func ResponseJSON(c *gin.Context, data interface{})
- type CommonResponse
- type ErrorCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Logger ¶
func Logger() gin.HandlerFunc
func Recovery ¶
func Recovery() gin.HandlerFunc
func ResponseError ¶
func ResponseErrorAndAbort ¶
func ResponseJSON ¶
Types ¶
type CommonResponse ¶
Click to show internal directories.
Click to hide internal directories.