httpx

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package httpx 提供 HTTP server 初始化和中间件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger() gin.HandlerFunc

Logger 日志中间件

func Recovery

func Recovery() gin.HandlerFunc

Recovery 恢复中间件

func RequestID

func RequestID() gin.HandlerFunc

RequestID 请求 ID 中间件

Types

type Config

type Config struct {
	Enabled bool
	Addr    string
}

Config HTTP 配置

type Server

type Server struct {
	Engine *gin.Engine
	Server *http.Server
}

Server HTTP 服务器

func NewServer

func NewServer(cfg Config) *Server

NewServer 创建 HTTP 服务器

func (*Server) Run

func (s *Server) Run() error

Run 启动服务器

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown 关闭服务器

Jump to

Keyboard shortcuts

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