From 1cef0eba5a66cbde8895c01625d14ab54d211d57 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 26 Jul 2022 03:52:33 -0400 Subject: [PATCH] Hard coded units for now, minor formatting updates --- server/current.go | 6 ++---- server/main.go | 4 ++-- test-client/main.go | 3 ++- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/server/current.go b/server/current.go index 93de7b4..5220c2a 100644 --- a/server/current.go +++ b/server/current.go @@ -16,7 +16,7 @@ func getCurrent(in *pb.RequestCurrent) string { url := "https://pro.openweathermap.org/data/2.5/weather?q=" token := "&appid=" + os.Getenv("API_KEY") - url = url + city + token + url = url + city + "&units=imperial" + token res, err := http.Get(url) if err != nil { @@ -28,12 +28,10 @@ func getCurrent(in *pb.RequestCurrent) string { if err != nil { log.Printf("Error reading weather response: %v", err) } - return string(body) - } -func (s *server) Current(ctx context.Context, in *pb.RequestCurrent) (*pb.SendCurrent, error) { +func (s *Server) Current(ctx context.Context, in *pb.RequestCurrent) (*pb.SendCurrent, error) { log.Println("'Current' function called...") return &pb.SendCurrent{ diff --git a/server/main.go b/server/main.go index 230db59..22ee58d 100644 --- a/server/main.go +++ b/server/main.go @@ -12,7 +12,7 @@ import ( "google.golang.org/grpc" ) -type server struct { +type Server struct { pb.WeatherServiceServer } @@ -33,7 +33,7 @@ func main() { } s := grpc.NewServer() - pb.RegisterWeatherServiceServer(s, &server{}) + pb.RegisterWeatherServiceServer(s, &Server{}) if err = s.Serve(lis); err != nil { log.Fatalf("gRPC Server error: %v\n", err) } diff --git a/test-client/main.go b/test-client/main.go index f456cd3..02d71a1 100644 --- a/test-client/main.go +++ b/test-client/main.go @@ -18,5 +18,6 @@ func main() { c := pb.NewWeatherServiceClient(conn) - doCurrent(c) + //doCurrent(c) + doExtended(c) }