modify routes
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package http
|
||||
|
||||
type Route interface {
|
||||
Register()
|
||||
}
|
||||
type Route interface{}
|
||||
|
||||
type Service interface {
|
||||
Serve() error
|
||||
|
||||
@@ -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),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user