TypeScript version of egg grpc client plugin.
Inspired by egg-grpc-client.
$ npm i egg-grpc-client-ts --save
// {app_root}/config/plugin.[t|j]s
exports.grpcClient = {
enable: true,
package: 'egg-grpc-client-ts',
};
// {app_root}/config/config.default.[t|j]s
exports.grpcClient = {
clients: {
main: {
protoPath: 'app/proto/main',
host: '0.0.0.0',
port: 50051,
},
},
};
see config/config.default.ts for more detail.
-
Full example of usage in plain js version of egg in this project's test directory: https://github.com/Jeff-Tian/egg-grpc-client-ts/tree/master/test/fixtures/apps/grpc-client-test
-
Full example of usage in typescript version of egg with step by step guide: https://github.com/Jeff-Tian/egg-grpc-client-ts-example
Please open an issue here.
# start test grpc server
npm run test-server
# In another shell, run:
npm run test-local
-
1.1.5: 报错时,把相关 server address, service, method, 参数 等元信息带上。
-
1.1.6: fail fast。默认超时时间为 10 秒(原来默认 1 分钟,太长了)
-
2.0.1: 允许传入 grpcMeta,实现分布式链路跟踪
-
2.1.0: grpc 健康检查