Gin http driver for Goravel.
goravel/gin | goravel/framework |
---|---|
v1.2.x | v1.14.x |
v1.1.x | v1.13.x |
- Add package
go get -u github.com/goravel/gin
- Register service provider
// config/app.go
import "github.com/goravel/gin"
"providers": []foundation.ServiceProvider{
...
&gin.ServiceProvider{},
}
- Add gin config to
config/http.go
file
// config/http.go
import (
ginfacades "github.com/goravel/gin/facades"
"github.com/gin-gonic/gin/render"
"github.com/goravel/gin"
)
"default": "gin",
"drivers": map[string]any{
"gin": map[string]any{
// Optional, default is 4096 KB
"body_limit": 4096,
"header_limit": 4096,
"route": func() (route.Route, error) {
return ginfacades.Route(), nil
},
// Optional, default is http/template
"template": func() (render.HTMLRender, error) {
return gin.DefaultTemplate()
},
},
},
Run command below to run test:
go test ./...