enterprise/server/server.go

27 lines
589 B
Go

package server
import (
"enterprise/common/config"
"enterprise/server/controller"
"github.com/gin-gonic/gin"
)
func initRoutge(engine *gin.Engine) {
qyweixin := new(controller.QyWeixin)
staff := new(controller.Staff)
base := new(controller.Base)
apiGroup := engine.Group("/api")
apiGroup.Use(base.Recovery)
apiGroup.Any("/qyweixin/approve", qyweixin.Approve)
apiGroup.GET("/staff/salary", staff.Salary)
engine.LoadHTMLGlob("conf/template/*")
}
func Start() error {
cfg := config.GetConfig()
engine := gin.New()
initRoutge(engine)
return engine.Run(cfg.Server.Address)
}