func main() {
	flag.Parse()
	lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}
	grpcServer := grpc.NewServer()
	pb.RegisterProfileServer(grpcServer, newServer())
	grpcServer.Serve(lis)
}
Exemple #2
0
func main() {
	var (
		port     = flag.Int("port", 10003, "The server port")
		dataPath = flag.String("data_path", "data/profiles.json", "A json file containing a list of customers")
	)
	flag.Parse()

	lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
	if err != nil {
		log.Fatalf("failed to listen: %v", err)
	}

	grpcServer := grpc.NewServer()
	pb.RegisterProfileServer(grpcServer, newServer(*dataPath))
	grpcServer.Serve(lis)
}