예제 #1
0
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.RegisterGeoServer(grpcServer, newServer())
	grpcServer.Serve(lis)
}
예제 #2
0
func main() {
	var (
		port     = flag.Int("port", 10002, "The server port")
		dataPath = flag.String("data_path", "data/locations.json", "A json file containing hotel locations")
	)
	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.RegisterGeoServer(grpcServer, newServer(*dataPath))
	grpcServer.Serve(lis)
}