Help us shape the future of Go! Take the 2026 Go Developer Survey

http/

directory
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0

README

transport/http/ - HTTP 协议适配

此目录存放 HTTP 协议相关的适配代码。

目录结构

http/
├── handler/        # HTTP 请求处理器实现(复杂场景)
└── middleware/     # HTTP 中间件

内容说明

handler/
  • 复杂业务场景的 handler 实现
  • 简单场景直接在 gen/http/handler/ 中处理即可
middleware/
  • 全局 HTTP 中间件
  • 认证、日志、CORS、限流、熔断等

示例

// middleware/auth.go
func Auth() app.HandlerFunc {
    return func(ctx context.Context, c *app.RequestContext) {
        // 认证逻辑
        c.Next(ctx)
    }
}

Directories

Path Synopsis
Package handler 提供定制 HTTP handlers(不走 thrift IDL 生成)。
Package handler 提供定制 HTTP handlers(不走 thrift IDL 生成)。

Jump to

Keyboard shortcuts

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