⏪ Pick up the single-page application as frontend
This commit is contained in:
@ -17,27 +17,31 @@ type Server struct {
|
||||
proto.UnimplementedFriendshipsServer
|
||||
proto.UnimplementedRealmsServer
|
||||
health.UnimplementedHealthServer
|
||||
|
||||
srv *grpc.Server
|
||||
}
|
||||
|
||||
var S *grpc.Server
|
||||
func NewServer() *Server {
|
||||
server := &Server{
|
||||
srv: grpc.NewServer(),
|
||||
}
|
||||
|
||||
func NewGRPC() {
|
||||
S = grpc.NewServer()
|
||||
proto.RegisterAuthServer(server.srv, &Server{})
|
||||
proto.RegisterNotifyServer(server.srv, &Server{})
|
||||
proto.RegisterFriendshipsServer(server.srv, &Server{})
|
||||
proto.RegisterRealmsServer(server.srv, &Server{})
|
||||
health.RegisterHealthServer(server.srv, &Server{})
|
||||
|
||||
proto.RegisterAuthServer(S, &Server{})
|
||||
proto.RegisterNotifyServer(S, &Server{})
|
||||
proto.RegisterFriendshipsServer(S, &Server{})
|
||||
proto.RegisterRealmsServer(S, &Server{})
|
||||
health.RegisterHealthServer(S, &Server{})
|
||||
reflection.Register(server.srv)
|
||||
|
||||
reflection.Register(S)
|
||||
return server
|
||||
}
|
||||
|
||||
func ListenGRPC() error {
|
||||
func (v *Server) Listen() error {
|
||||
listener, err := net.Listen("tcp", viper.GetString("grpc_bind"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return S.Serve(listener)
|
||||
return v.srv.Serve(listener)
|
||||
}
|
||||
|
Reference in New Issue
Block a user