Documentation ¶
Index ¶
- Variables
- type RouterGroup
- func (rg *RouterGroup) DELETE(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (rg *RouterGroup) GET(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (rg *RouterGroup) Group(prefix string) *RouterGroup
- func (rg *RouterGroup) HEAD(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (rg *RouterGroup) OPTIONS(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (rg *RouterGroup) PATCH(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (rg *RouterGroup) POST(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (rg *RouterGroup) PUT(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- type Server
- func (s *Server) AddMiddleware(h gin.HandlerFunc)
- func (s *Server) DELETE(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (s *Server) GET(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (s *Server) GetRoutePaths() []string
- func (s *Server) HEAD(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (s *Server) LoggerSkipPaths(paths ...string)
- func (s *Server) OPTIONS(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (s *Server) PATCH(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (s *Server) POST(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (s *Server) PUT(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
- func (s *Server) Start() error
- func (s *Server) Stop(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ( CORSDefaultAllowMethods = []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD"} // CORS safelisted-request-header: https://fetch.spec.whatwg.org/#cors-safelisted-request-header // CORS forbidden-header-name: https://fetch.spec.whatwg.org/#forbidden-header-name CORSDefaultAllowHeaders = []string{ "Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language", "Content-Language", "Content-Length", "Content-Type", "Host", "Origin", } CORSDefaultAllowCredentials = true CORSDefaultMaxAge = 12 * time.Hour )
Functions ¶
This section is empty.
Types ¶
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
RouterGroup groups path under one path prefix.
func (*RouterGroup) DELETE ¶
func (rg *RouterGroup) DELETE(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
DELETE registers HTTP server endpoint with Delete method.
func (*RouterGroup) GET ¶
func (rg *RouterGroup) GET(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
GET registers HTTP server endpoint with Get method.
func (*RouterGroup) Group ¶
func (rg *RouterGroup) Group(prefix string) *RouterGroup
Group creates new RouterGroup with the given path prefix.
func (*RouterGroup) HEAD ¶
func (rg *RouterGroup) HEAD(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
HEAD registers HTTP server endpoint with Head method.
func (*RouterGroup) OPTIONS ¶
func (rg *RouterGroup) OPTIONS(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
OPTIONS registers HTTP server endpoint with Options method.
func (*RouterGroup) PATCH ¶
func (rg *RouterGroup) PATCH(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
PATCH registers HTTP server endpoint with Patch method.
func (*RouterGroup) POST ¶
func (rg *RouterGroup) POST(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
POST registers HTTP server endpoint with Post method.
func (*RouterGroup) PUT ¶
func (rg *RouterGroup) PUT(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
PUT registers HTTP server endpoint with Put method.
type Server ¶
type Server struct { RouterGroup CORS *cors.Config Port string // contains filtered or unexported fields }
Server represents the implementation of HTTP server object.
func (*Server) AddMiddleware ¶
func (s *Server) AddMiddleware(h gin.HandlerFunc)
AddMiddleware adds a gin middleware the HTTP server.
func (*Server) DELETE ¶
func (s *Server) DELETE(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
DELETE registers HTTP server endpoint with Delete method.
func (*Server) GET ¶
func (s *Server) GET(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
GET registers HTTP server endpoint with Get method.
func (*Server) GetRoutePaths ¶
GetRoutePaths retrieves all route paths registerd to this HTTP server.
func (*Server) HEAD ¶
func (s *Server) HEAD(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
HEAD registers HTTP server endpoint with Head method.
func (*Server) LoggerSkipPaths ¶
LoggerSkipPaths registers endpoint paths that you want to skip from being logged by the logger middleware.
func (*Server) OPTIONS ¶
func (s *Server) OPTIONS(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
OPTIONS registers HTTP server endpoint with Options method.
func (*Server) PATCH ¶
func (s *Server) PATCH(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
PATCH registers HTTP server endpoint with Patch method.
func (*Server) POST ¶
func (s *Server) POST(relativePath string, logPayload bool, handlers ...gin.HandlerFunc)
POST registers HTTP server endpoint with Post method.