Open jaronnie opened 5 days ago
// shutdown listener wailExit := proc.AddShutdownListener(svcCtx.Custom.Stop) eg := errgroup.Group{} eg.Go(func() error { fmt.Printf("Starting rpc server at %s...\n", svcCtx.Config.Zrpc.ListenOn) fmt.Printf("Starting gateway server at %s:%d...\n", svcCtx.Config.Gateway.Host, svcCtx.Config.Gateway.Port) group.Start() return nil }) // add your custom logic in custom.Do() eg.Go(func() error { svcCtx.Custom.Start() return nil }) if err := eg.Wait(); err != nil { panic(err) } wailExit()
define a custom struct in svc.ServiceContext. And add custom.Start and Stop method
在 https://github.com/jzero-io/templates 的 gateway 分支进行规范化