http

package
v0.0.0-...-21c6822 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 5 Imported by: 0

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

type HttpRouter interface {
	RegisterRoutes(engine *gin.Engine)
}

HttpRouter is an interface for HTTP routers that can register routes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL