egg-grpc-client-ts
TypeScript icon, indicating that this package has built-in type declarations

3.0.2 • Public • Published

egg-grpc-client-ts

TypeScript version of egg grpc client plugin.

Inspired by egg-grpc-client.

NPM version Build Status codecov David deps Known Vulnerabilities npm download

Install

$ npm i egg-grpc-client-ts --save

Usage

// {app_root}/config/plugin.[t|j]s
exports.grpcClient = {
  enable: true,
  package: 'egg-grpc-client-ts',
};

Configuration

// {app_root}/config/config.default.[t|j]s
exports.grpcClient = {
  clients: [
    {
      name: 'main',
      protoPath: 'app/proto/main',
      host: '0.0.0.0',
      port: 50051,
    },
  ],
};

see config/config.default.ts for more detail.

Example

Questions & Suggestions

Please open an issue here.

License

MIT

Test

# start test grpc server 
npm run test-server
 
# In another shell, run: 
npm run test-local

Release Notes:

  • 1.1.5: 报错时,把相关 server address, service, method, 参数 等元信息带上。

  • 1.1.6: fail fast。默认超时时间为 10 秒(原来默认 1 分钟,太长了)

  • 2.0.1: 允许传入 grpcMeta,实现分布式链路跟踪

  • 2.1.0: grpc 健康检查

/egg-grpc-client-ts/

    Package Sidebar

    Install

    npm i egg-grpc-client-ts

    Weekly Downloads

    6

    Version

    3.0.2

    License

    MIT

    Unpacked Size

    22.4 kB

    Total Files

    8

    Last publish

    Collaborators

    • jeff-tian