Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewServer ¶
func NewServer(httpRouters ...HttpRouter) *gin.Engine
NewServer creates a new Gin engine and registers routes from provided HttpRouters.
Types ¶
type APIRouterGroup ¶
type APIRouterGroup struct {
// contains filtered or unexported fields
}
func NewAPIRouterGroup ¶
func NewAPIRouterGroup(group *gin.RouterGroup) *APIRouterGroup
func (*APIRouterGroup) Register ¶
func (g *APIRouterGroup) Register(specs ...EndpointSpec)
type EndpointSpec ¶
type EndpointSpec struct {
Method string
Path string
Middlewares []gin.HandlerFunc
// Handler supports:
// func(*gin.Context)
// func(*gin.Context) error
// func(*gin.Context, T) error
// func(*gin.Context, *T) error
Handler interface{}
// BindFrom: "", "json", "query" (default: auto by HTTP method)
BindFrom string
}
type HttpRouter ¶
HttpRouter is an interface for HTTP routers that can register routes.
Click to show internal directories.
Click to hide internal directories.