Skip to content

Commit

Permalink
Merge pull request #90 from paskozdilar/master
Browse files Browse the repository at this point in the history
Use same options in proto compile and load
  • Loading branch information
badsyntax authored Feb 29, 2024
2 parents 12cef07 + e5b58da commit 52d1394
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion examples/grpc-proto-loader/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { ProtoGrpcType } from './proto/example';
import { ServerMessage } from './proto/example_package/ServerMessage';

const host = '0.0.0.0:9090';
const packageDefinition = protoLoader.loadSync('./proto/example.proto');
const packageDefinition = protoLoader.loadSync('./proto/example.proto', {
longs: String,
enums: String,
defaults: true,
oneofs: true,
});
const proto = grpc.loadPackageDefinition(
packageDefinition
) as unknown as ProtoGrpcType;
Expand Down
7 changes: 6 additions & 1 deletion examples/grpc-proto-loader/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ const exampleServer: ExampleHandlers = {
};

function getServer(): grpc.Server {
const packageDefinition = protoLoader.loadSync('./proto/example.proto');
const packageDefinition = protoLoader.loadSync('./proto/example.proto', {
longs: String,
enums: String,
defaults: true,
oneofs: true,
});
const proto = grpc.loadPackageDefinition(
packageDefinition
) as unknown as ProtoGrpcType;
Expand Down

0 comments on commit 52d1394

Please sign in to comment.