Initial commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"pet-house.com/core/server/viper_server"
|
||||
"pet-house.com/core/server/zap_server"
|
||||
)
|
||||
|
||||
// init
|
||||
func init() {
|
||||
viper_server.Init(getViperConfig())
|
||||
}
|
||||
|
||||
type WebBaseFunc interface {
|
||||
AddWebStatic(staticAbsPath, webPrefix string, paths ...string)
|
||||
AddUploadStatic(staticAbsPath, webPrefix string)
|
||||
InitRouter() error
|
||||
Run()
|
||||
}
|
||||
|
||||
// WebFunc
|
||||
// - GetTestClient
|
||||
// - GetTestLogin
|
||||
// - AddWebStatic
|
||||
// - AddUploadStatic
|
||||
// - Run
|
||||
type WebFunc interface {
|
||||
WebBaseFunc
|
||||
}
|
||||
|
||||
// Start
|
||||
func Start(wf WebFunc) {
|
||||
err := wf.InitRouter()
|
||||
if err != nil {
|
||||
zap_server.ZAPLOG.Error(err.Error())
|
||||
return
|
||||
}
|
||||
wf.Run()
|
||||
}
|
||||
|
||||
// StartTest
|
||||
func StartTest(wf WebFunc) {
|
||||
err := wf.InitRouter()
|
||||
if err != nil {
|
||||
zap_server.ZAPLOG.Error(err.Error())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user