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

@@ -1,6 +1,7 @@
package swagger
import (
"github.com/rogeecn/atom"
"github.com/rogeecn/atom/container"
"github.com/rogeecn/atom/utils/opt"
ginSwagger "github.com/swaggo/gin-swagger"
@@ -23,6 +24,7 @@ func DefaultProvider() container.ProviderContainer {
Provider: Provide,
Options: []opt.Option{
opt.Prefix(DefaultPrefix),
opt.Group(atom.GroupInitialName),
},
}
}

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()...)
}