package main
import (
"fmt"
_"github.com/go-sql-driver/mysql"
"google.golang.org/grpc"
pb"jiuye.com/dto"
server"jiuye.com/server"
"log"
"net"
)
const (
port= ":50051"
)
func main() {
lis, err:= net.Listen("tcp", port)
if err!= nil {
log.Fatalf("failed to listen: %v", err)
}
s:= grpc.NewServer()
pb.RegisterGreeterServer(s, &server.UserServer{})
if err:= s.Serve(lis); err!= nil {
fmt.Println("failed to serve: %v", err)
}
}
// protoc --go_out=plugins=grpc:. -I /Users/luli/jiuye_proto3 user.proto
有疑问加站长微信联系(非本文作者)