optimize servants code layout

pull/196/head
Michael Li 2 years ago
parent 25158d7c06
commit df1744fc64

@ -1,13 +0,0 @@
//go:build !docs
// +build !docs
package servants
import (
"github.com/gin-gonic/gin"
)
// registerDocs stub function for register docs asset route
func registerDocs(e *gin.Engine) {
// empty
}

@ -0,0 +1,13 @@
//go:build !docs
// +build !docs
package docs
import (
"github.com/gin-gonic/gin"
)
// RegisterDocs stub function for register docs asset route
func RegisterDocs(e *gin.Engine) {
// empty
}

@ -1,7 +1,7 @@
//go:build docs
// +build docs
package servants
package docs
import (
"github.com/gin-gonic/gin"
@ -9,8 +9,8 @@ import (
"github.com/rocboss/paopao-ce/pkg/cfg"
)
// registerDocs register docs asset route
func registerDocs(e *gin.Engine) {
// RegisterDocs register docs asset route
func RegisterDocs(e *gin.Engine) {
cfg.Be("Docs:OpenAPI", func() {
e.StaticFS("/docs/openapi", openapi.NewFileSystem())
})

@ -2,7 +2,9 @@ package servants
import (
"github.com/gin-gonic/gin"
"github.com/rocboss/paopao-ce/internal/servants/docs"
"github.com/rocboss/paopao-ce/internal/servants/localoss"
"github.com/rocboss/paopao-ce/internal/servants/statick"
"github.com/rocboss/paopao-ce/internal/servants/web"
"github.com/rocboss/paopao-ce/pkg/cfg"
)
@ -11,8 +13,8 @@ import (
func RegisterWebServants(e *gin.Engine) {
// 按需注册 docs、静态资源
{
registerDocs(e)
registerStatick(e)
docs.RegisterDocs(e)
statick.RegisterStatick(e)
}
web.RouteWeb(e)

@ -1,13 +0,0 @@
//go:build !embed
// +build !embed
package servants
import (
"github.com/gin-gonic/gin"
)
// registerStatick stub function for register static asset route
func registerStatick(e *gin.Engine) {
// empty
}

@ -0,0 +1,13 @@
//go:build !embed
// +build !embed
package statick
import (
"github.com/gin-gonic/gin"
)
// RegisterStatick stub function for register static asset route
func RegisterStatick(e *gin.Engine) {
// empty
}

@ -1,7 +1,7 @@
//go:build embed
// +build embed
package servants
package statick
import (
"net/http"
@ -10,8 +10,8 @@ import (
"github.com/rocboss/paopao-ce/web"
)
// registerStatick register static assets route
func registerStatick(e *gin.Engine) {
// RegisterStatick register static assets route
func RegisterStatick(e *gin.Engine) {
routeStatic(e, "/", "/index.html", "/favicon.ico", "/assets/*filepath")
}

@ -1,8 +0,0 @@
package version
var (
// GitHash Value will be set during build
GitHash = ""
// BuildTime Value will be set during build
BuildTime = ""
)
Loading…
Cancel
Save