File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ type Service struct {
1212
1313type GrpcServer struct {
1414 pb.UnimplementedQuestionMatchingServiceServer // Embed the unimplemented service
15+ Client * firestore.Client
1516}
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ func main() {
4949 return
5050 }
5151
52- go initGrpcServer ()
52+ go initGrpcServer (service )
5353
5454 r := initChiRouter (service )
5555 initRestServer (r )
@@ -121,13 +121,15 @@ func initRestServer(r *chi.Mux) {
121121 }
122122}
123123
124- func initGrpcServer () {
124+ func initGrpcServer (service * handlers. Service ) {
125125 lis , err := net .Listen ("tcp" , ":50051" )
126126 if err != nil {
127127 log .Fatalf ("failed to listen: %v" , err )
128128 }
129129 s := grpc .NewServer ()
130- pb .RegisterQuestionMatchingServiceServer (s , & handlers.GrpcServer {})
130+ pb .RegisterQuestionMatchingServiceServer (s , & handlers.GrpcServer {
131+ Client : service .Client ,
132+ })
131133
132134 log .Printf ("gRPC Server is listening on port 50051..." )
133135 if err := s .Serve (lis ); err != nil {
You can’t perform that action at this time.
0 commit comments