init repo
This commit is contained in:
47
cmd/main.go
Normal file
47
cmd/main.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/nose7en/ToyBoomServer/biz"
|
||||
"github.com/nose7en/ToyBoomServer/common"
|
||||
"github.com/nose7en/ToyBoomServer/config"
|
||||
"github.com/nose7en/ToyBoomServer/middleware"
|
||||
"github.com/nose7en/ToyBoomServer/rpc"
|
||||
"github.com/nose7en/ToyBoomServer/services/api"
|
||||
|
||||
"github.com/sourcegraph/conc"
|
||||
)
|
||||
|
||||
// go:embed all:out/*
|
||||
// var fs embed.FS
|
||||
|
||||
func main() {
|
||||
c := context.Background()
|
||||
|
||||
config.InitSettings()
|
||||
rpc.InitManager()
|
||||
middleware.Init()
|
||||
initDatabase()
|
||||
|
||||
// ------------ biz init ----------------
|
||||
// --------------------------------------
|
||||
|
||||
r := biz.Router()
|
||||
// biz.HandleStaticFile(r, fs, ar)
|
||||
|
||||
apiService := api.NewAPIHandler(config.GetSettings().APIListenAddr)
|
||||
apiService.Init(r)
|
||||
// watherService := watcher.NewClient(func() error {
|
||||
// return nil
|
||||
// })
|
||||
|
||||
common.Logger(c).Infof("------------------------------------------------")
|
||||
common.Logger(c).Infof("init services done, start to run all services...")
|
||||
common.Logger(c).Infof("------------------------------------------------")
|
||||
|
||||
var wg conc.WaitGroup
|
||||
wg.Go(apiService.Run)
|
||||
// wg.Go(watherService.Run)
|
||||
wg.Wait()
|
||||
}
|
||||
Reference in New Issue
Block a user