egg-thrift-client

Thrift client plugin for egg

Usage no npm install needed!

<script type="module">
  import eggThriftClient from 'https://cdn.skypack.dev/egg-thrift-client';
</script>

README

egg-thrift-client

NPM version npm download

依赖说明

依赖的插件

需要在egg项目中安装thrift:

$ npm i thrift

开启插件

// config/plugin.js
exports.thriftClient = {
  enable: true,
  package: 'egg-thrift-client',
};

使用场景

插件用于在 egg 中创建 thrift client ,使用时建议增加心跳机制来保持连接。

demo

app.thriftClient.get('microService').client.doSomething(params, (err, res) => {
  if (err) {
    // errorHandle();
  } else {
    // resHandle();
  }
});

详细配置

请到 config/config.default.js 查看详细配置项说明。

License

MIT