Documentation
¶
Index ¶
- Constants
- func GetHttpHandler(opts ...option) http.Handler
- func RegisterGinApi(f func(router RouterGroup))
- func RegisterSessionInjector(injector SessionStoreInjector)
- func RequestLimiter(maxConcurrent int) gin.HandlerFunc
- func RequestLogger() gin.HandlerFunc
- func RunGin(ctx context.Context, opts ...option) error
- func WithCsrf(enable bool, secret string, fieldname string, excludePaths ...string) option
- func WithLoggerEnable(enable bool) option
- func WithMaxConcurrentRequests(limit int) option
- func WithMiddleware(middleware ...gin.HandlerFunc) option
- func WithMode(mode string) option
- func WithPort(port uint16) option
- func WithRouterGroup(routerGroup RouterGroup) option
- func WithSession(enable bool, store string, cookieName string, maxAge int, keyPairs ...string) option
- func WithStaticFS(path string, fs http.FileSystem) option
- func WithTracerEnable(enable bool) option
- type Router
- type RouterGroup
- type SessionStoreInjector
Constants ¶
View Source
const (
CtxKeyCSRFToken = ctxKey("gorilla.csrf.Token")
)
Variables ¶
This section is empty.
Functions ¶
func GetHttpHandler ¶
GetHttpHandler returns the singleton gin.Engine instance as an http.Handler. This allows the gin engine to be used with an existing http.Server.
func RegisterGinApi ¶
func RegisterGinApi(f func(router RouterGroup))
RegisterGinApi allows for the registration of API routes using a function. This function can be called from anywhere to add routes to the central routerGroup.
func RegisterSessionInjector ¶
func RegisterSessionInjector(injector SessionStoreInjector)
func RequestLimiter ¶
func RequestLimiter(maxConcurrent int) gin.HandlerFunc
func RequestLogger ¶
func RequestLogger() gin.HandlerFunc
func RunGin ¶
RunGin starts the gin server on the specified port and handles graceful shutdown. It blocks until the provided context is canceled.
func WithLoggerEnable ¶
func WithLoggerEnable(enable bool) option
func WithMaxConcurrentRequests ¶
func WithMaxConcurrentRequests(limit int) option
func WithMiddleware ¶
func WithMiddleware(middleware ...gin.HandlerFunc) option
func WithRouterGroup ¶
func WithRouterGroup(routerGroup RouterGroup) option
func WithSession ¶
func WithStaticFS ¶
func WithStaticFS(path string, fs http.FileSystem) option
func WithTracerEnable ¶
func WithTracerEnable(enable bool) option
Types ¶
type Router ¶
type Router interface {
GET(path string, handler gin.HandlerFunc)
POST(path string, handler gin.HandlerFunc)
PUT(path string, handler gin.HandlerFunc)
DELETE(path string, handler gin.HandlerFunc)
// contains filtered or unexported methods
}
Router defines the interface for registering routes. It supports GET, POST, PUT, and DELETE methods.
type RouterGroup ¶
func NewRouterGroup ¶
func NewRouterGroup() RouterGroup
newRouterGroup creates a new instance of a routerGroup.
type SessionStoreInjector ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.