2021-01-16 16:28:32 +08:00

28 lines
431 B
Go

// grpc server
package main
import (
"net"
"google.golang.org/grpc"
pb "github.com/esinio/geco/gen/proto/echo/v1"
srv "github.com/esinio/geco/service/echo/v1"
)
func main() {
s := grpc.NewServer()
pb.RegisterEchoServiceServer(s, srv.NewService())
lis, err := net.Listen("tcp", ":9090")
if err != nil {
panic(err)
}
defer lis.Close()
defer s.GracefulStop()
if err := s.Serve(lis); err != nil {
panic(err)
}
}