1
This commit is contained in:
parent
354c5e7166
commit
a5c700416c
@ -27,9 +27,10 @@ func (this *app) Run(initCb func(), unInitCb func()) {
|
|||||||
func (this *app) Init() {
|
func (this *app) Init() {
|
||||||
f5.LoadMetaTable(mt.Table)
|
f5.LoadMetaTable(mt.Table)
|
||||||
this.registerDataSources()
|
this.registerDataSources()
|
||||||
//this.ginEngine = gin.New()
|
this.ginEngine = gin.New()
|
||||||
//this.ginEngine.Use(gin.Recovery())
|
this.ginEngine.Use(gin.Recovery())
|
||||||
this.initCb()
|
this.initCb()
|
||||||
|
go this.ginEngine.Run(":3000")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *app) UnInit() {
|
func (this *app) UnInit() {
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
//"adminsever/api"
|
|
||||||
//"adminsever/db"
|
|
||||||
"f5"
|
|
||||||
"main/router"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"golang.org/x/sync/errgroup"
|
|
||||||
"net/http"
|
|
||||||
)
|
|
||||||
|
|
||||||
type GinMgr struct {
|
|
||||||
group errgroup.Group
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GinMgr) init() {
|
|
||||||
runGinServer()
|
|
||||||
//server01 := &http.Server{
|
|
||||||
// Addr: ":8080",
|
|
||||||
// Handler: this.router(),
|
|
||||||
// ReadTimeout: 5 * time.Second,
|
|
||||||
// WriteTimeout: 10 * time.Second,
|
|
||||||
//}
|
|
||||||
//this.group.Go(func() error {
|
|
||||||
// return server01.ListenAndServe()
|
|
||||||
//})
|
|
||||||
f5.GetSysLog().Info("%s", router.RouterGroupApp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GinMgr) unInit() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (this *GinMgr) router() http.Handler {
|
|
||||||
r := gin.New()
|
|
||||||
r.Use(gin.Recovery())
|
|
||||||
r.GET("/webapp/index.php", func(c *gin.Context) {
|
|
||||||
c.JSON(200, gin.H{
|
|
||||||
"errcode": 0,
|
|
||||||
"errmsg": "",
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return r
|
|
||||||
}
|
|
||||||
|
|
||||||
func runGinServer() {
|
|
||||||
/*
|
|
||||||
store := db.GetDB()
|
|
||||||
server, err := api.NewServer(store)
|
|
||||||
if err != nil {
|
|
||||||
f5.GetSysLog().Info("cannot create server err:%v \n", err)
|
|
||||||
}
|
|
||||||
err = server.Start("localhost:8080")
|
|
||||||
if err != nil {
|
|
||||||
f5.GetSysLog().Info("cannot start server err:%v \n", err)
|
|
||||||
}*/
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package router
|
|
||||||
|
|
||||||
import (
|
|
||||||
"main/router/system"
|
|
||||||
)
|
|
||||||
|
|
||||||
type RouterGroup struct {
|
|
||||||
System system.RouterGroup
|
|
||||||
}
|
|
||||||
|
|
||||||
var RouterGroupApp = new(RouterGroup)
|
|
Loading…
x
Reference in New Issue
Block a user