http

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(c *gin.Context)

CORS 跨域中间件

func Recover

func Recover() gin.HandlerFunc

func RequestLog

func RequestLog() gin.HandlerFunc

func Trace

func Trace(traceHeader string) gin.HandlerFunc

Types

type Server

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

Server represents an HTTP server.

func NewServer

func NewServer(addr string) *Server

NewServer returns a new instance of the Server.

func (*Server) AddShutdownHook

func (server *Server) AddShutdownHook(hook func()) *Server

AddShutdownHook adds a callback function what's called before the server is shutdown

func (*Server) AddStartHook

func (server *Server) AddStartHook(hook func()) *Server

AddStartHook adds a hook function what's called before server is start

func (*Server) EnableAvailableHealthCheck

func (server *Server) EnableAvailableHealthCheck() *Server

EnableAvailableHealthCheck enables the health check

func (*Server) EnableCorsMiddleware

func (server *Server) EnableCorsMiddleware() *Server

EnableCorsMiddleware enables cors middleware

func (*Server) EnablePprofHandler

func (server *Server) EnablePprofHandler() *Server

EnablePprofHandler enables the profiler for the http server

func (*Server) EnableReleaseMode

func (server *Server) EnableReleaseMode() *Server

EnableReleaseMode enables the release mode for the http server,it will hide the route tables

func (*Server) EnableSwaggerHandler

func (server *Server) EnableSwaggerHandler() *Server

EnableSwaggerHandler enables the swagger handler for the http server

func (*Server) EnableTraceMiddleware

func (server *Server) EnableTraceMiddleware(traceHeader string) *Server

EnableTraceMiddleware enables trace middleware with trace header name

func (*Server) EnableTracing added in v1.1.4

func (server *Server) EnableTracing(service, address string) *Server

EnableTracing enables tracing of jaeger

func (*Server) RegisterRouteLoader

func (server *Server) RegisterRouteLoader(loader func(router *gin.Engine)) *Server

RegisterRouteLoader registers a route loader

func (*Server) Run added in v1.1.9

func (server *Server) Run(stop <-chan struct{})

Run starts the server.

func (*Server) Shutdown

func (server *Server) Shutdown()

Shutdown shuts down the server.

func (*Server) WithDefaultRecoverMiddleware

func (server *Server) WithDefaultRecoverMiddleware() *Server

WithDefaultRecoverMiddleware enables default recover middleware

func (*Server) WithDefaultRequestLogMiddleware

func (server *Server) WithDefaultRequestLogMiddleware() *Server

WithDefaultRequestLogMiddleware enables the default request log middleware.

func (*Server) WithNotFoundHandler

func (server *Server) WithNotFoundHandler(notFoundHandler ...gin.HandlerFunc) *Server

WithNotFoundHandler provide the handler for not found routes and methods

func (*Server) WithTLSConfig added in v1.1.9

func (server *Server) WithTLSConfig(cfg *tls.Config) *Server

WithTLSConfig sets the tls configuration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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