Documentation
¶
Overview ¶
Example ¶
package main
import (
"github.com/boxgo/box/pkg/logger"
"github.com/boxgo/box/pkg/server/ginserver"
"github.com/boxgo/box/pkg/server/ginserver/mid/ginprom"
"github.com/gin-gonic/gin"
)
func main() {
ginserver.Use(ginprom.Handler())
ginserver.GET("/ping", func(ctx *gin.Context) {
ctx.Data(200, "text/plain", []byte("pong"))
})
if err := ginserver.Run(); err != nil {
logger.Fatal(err)
}
}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Default = StdConfig("default").Build()
)
Functions ¶
func Handler ¶
func Handler() gin.HandlerFunc
func UrlMapping ¶
Types ¶
type GinProm ¶
type GinProm struct {
// contains filtered or unexported fields
}
func (*GinProm) Handler ¶
func (prom *GinProm) Handler() gin.HandlerFunc
type OptionFunc ¶
type OptionFunc func(*Config)
OptionFunc 选项信息
func WithURLMapping ¶
func WithURLMapping(fn func(*gin.Context) string) OptionFunc
WithURLMapping set up url mapping func default is: UrlMapping
Click to show internal directories.
Click to hide internal directories.