Skip to content

Commit

Permalink
Add grpc reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
HOU-SZ committed Jul 10, 2022
1 parent 1a1f853 commit e98c2e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/HOU-SZ/pcbook/pb"
"github.com/HOU-SZ/pcbook/service"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)

func main() {
Expand All @@ -22,6 +23,8 @@ func main() {
laptopServer := service.NewLaptopServer(laptopStore, imageStore, ratingStore)
grpcServer := grpc.NewServer()
pb.RegisterLaptopServiceServer(grpcServer, laptopServer)
// Register reflection service on gRPC server.
reflection.Register(grpcServer)

address := fmt.Sprintf("0.0.0.0:%d", *port)
listener, err := net.Listen("tcp", address)
Expand Down

0 comments on commit e98c2e2

Please sign in to comment.