modify routes

This commit is contained in:
yanghao05
2023-06-09 14:58:29 +08:00
parent 3f27dee0b2
commit aee21ec772
7 changed files with 46 additions and 17 deletions

View File

@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/rogeecn/atom/container"
"github.com/rogeecn/atom/contracts"
"github.com/rogeecn/atom/providers/http"
"github.com/rogeecn/atom/utils/opt"
swaggerFiles "github.com/swaggo/files"
@@ -12,9 +13,6 @@ import (
"github.com/swaggo/swag"
)
type Swagger struct {
}
func Provide(opts ...opt.Option) error {
o := opt.New(opts...)
var config Config
@@ -22,7 +20,7 @@ func Provide(opts ...opt.Option) error {
return err
}
return container.Container.Provide(func(http http.Service) *Swagger {
return container.Container.Provide(func(http http.Service) contracts.Initial {
if config.BaseRoute == "" {
config.BaseRoute = "swagger"
}
@@ -50,6 +48,6 @@ func Provide(opts ...opt.Option) error {
}
engine.GET(fmt.Sprintf("/%s/*any", config.BaseRoute), handler)
return &Swagger{}
return nil
}, o.DiOptions()...)
}