handlerfunc

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: MIT Imports: 7 Imported by: 0

README

handlerfunc

Commonly used public handlers.


Example of use

	r := gin.New()
	r.GET("/health", handlerfunc.CheckHealth)
	r.GET("/ping", handlerfunc.Ping)

Documentation

Overview

Package handlerfunc is used for public http request handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrowserRefresh

func BrowserRefresh(path string) func(c *gin.Context)

BrowserRefresh solve vue using history route 404 problem, for system file

func BrowserRefreshFS

func BrowserRefreshFS(fs embed.FS, path string) func(c *gin.Context)

BrowserRefreshFS solve vue using history route 404 problem, for embed.FS

func CheckHealth

func CheckHealth(c *gin.Context)

CheckHealth check healthy. @Summary check system health status @Description Returns system health information including status and hostname @Tags system @Accept json @Produce json @Success 200 {object} CheckHealthReply "Returns health status information" @Router /health [get]

func ListCodes

func ListCodes(c *gin.Context)

ListCodes list error codes info @Summary list all error codes @Description Returns a list of all defined HTTP error codes and their descriptions @Tags system @Accept json @Produce json @Success 200 {array} errcode.ErrInfo "List of error codes" @Router /codes [get]

func Ping

func Ping(c *gin.Context)

Ping the server @Summary ping the server @Description Simple ping endpoint to check if server is responsive @Tags system @Accept json @Produce json @Success 200 {object} PingReply "Returns empty JSON object" @Router /ping [get]

Types

type CheckHealthReply

type CheckHealthReply struct {
	Status   string `json:"status"`
	Hostname string `json:"hostname"`
}

CheckHealthReply check health result

type PingReply added in v1.14.0

type PingReply struct{}

Jump to

Keyboard shortcuts

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