http

package
v0.0.0-...-c0eec92 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusOK = 0

	// AdminAPI 管理后台接口前缀
	AdminAPI = "/admin"
	// API 接口前缀
	API = "/api"
	// OpenAPI 不需要鉴权的接口前缀
	OpenAPI = API + "/open"

	RequestHeaderAdminUID   = "X-Admin-UID"
	RequestHeaderAdminToken = "X-Admin-Token"

	ResponseHeaderServer       = "Server"
	ResponseHeaderRefreshToken = "X-Refresh-Token"
)

Variables

View Source
var GzipMiddleware = middleware.Compress(5, "gzip")

Functions

func ErrorEncoder

func ErrorEncoder(ctx context.Context, err error, w http.ResponseWriter)

ErrorEncoder 统一异常处理

func GetServer

func GetServer() *luchen.HTTPServer

func ResponseWrapper

func ResponseWrapper(data interface{}) interface{}

func WriteData

func WriteData(ctx context.Context, w http.ResponseWriter, httpCode int, data any)

Types

This section is empty.

Jump to

Keyboard shortcuts

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