ToyBoomServer/cmd/main.go
2024-09-02 18:07:30 +00:00

48 lines
1.1 KiB
Go

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()
}