middlewares

package
v0.0.0-...-7285f2c Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupStaticFileSupport

func SetupStaticFileSupport(address string, folder string, displayDir ...bool) webapi.Middleware

SetupStaticFileSupport 静态文件支持

Types

type AccessLogger

type AccessLogger struct {
	// contains filtered or unexported fields
}

AccessLogger 访问记录器

func SetupAccessLogger

func SetupAccessLogger(logger ...webapi.LogService) (accesslogger *AccessLogger)

SetupAccessLogger 设置访问日志

func (*AccessLogger) Invoke

func (logger *AccessLogger) Invoke(ctx *webapi.Context, next webapi.HTTPHandler)

Invoke 记录访问日志

type Recovery

type Recovery struct {
	// contains filtered or unexported fields
}

Recovery panic错误捕获中间件

func SetupRecoveryHandler

func SetupRecoveryHandler(handler ...func(string, string) string) (r *Recovery)

SetupRecoveryHandler 设置重启中间件的自定义错误处理函数,handler函数不能再次出现未处理的panic,否则服务将中断退出

func (*Recovery) Invoke

func (r *Recovery) Invoke(ctx *webapi.Context, next webapi.HTTPHandler)

Invoke 中间件调用约定

type StaticFileHandler

type StaticFileHandler struct {
	// contains filtered or unexported fields
}

StaticFileHandler 静态文件

func (*StaticFileHandler) Invoke

func (handler *StaticFileHandler) Invoke(ctx *webapi.Context, next webapi.HTTPHandler)

Invoke 中间件调用约定

Jump to

Keyboard shortcuts

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