47 lines
745 B
Go
47 lines
745 B
Go
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())
|
|
}
|
|
}
|