server.go 505 B

1234567891011121314151617181920
  1. package grpc
  2. import (
  3. v1pb "go-common/app/service/live/recommend/api/grpc/v1"
  4. "go-common/app/service/live/recommend/internal/conf"
  5. svc "go-common/app/service/live/recommend/internal/service/v1"
  6. "go-common/library/log"
  7. "go-common/library/net/rpc/warden"
  8. )
  9. // Init grpc server
  10. func Init(c *conf.Config) {
  11. s := warden.NewServer(nil)
  12. v1pb.RegisterRecommendServer(s.Server(), svc.NewRecommendService(c))
  13. _, err := s.Start()
  14. if err != nil {
  15. log.Error("grpc Start error(%v)", err)
  16. panic(err)
  17. }
  18. }