difference between protoloader and generated .js files from grpc

35 views
Skip to first unread message

hounaida rekik

unread,
Jan 14, 2021, 12:03:59 PM1/14/21
to grpc.io
I am a beginner in GRPC and nodejs. For the first time, I use protoloader to load my services from proto. Then, I want to switch to use generated files from grpc: in my case I have: comment_pb.js, So I replace this code with:
import protoLoader from '@grpc/proto-loader'; const packageDefinition = protoLoader.loadSync('../../../protos/comment.proto', { keepCase: true, longs: String, enums: String, arrays: true }); //pass proto in grpc var commentProto = grpc.loadPackageDefinition(packageDefinition);

With:
import protoLoader from './proto/comment_pb.js';

I don't know what's the diff between these two methods, does this change and impact the rest of the code? there are any helpful links about this.
Reply all
Reply to author
Forward
0 new messages