egg-tchannel
tchannel plugin for egg.
Install
$ npm i tchannel $ npm i egg-tchannel
Configuration
egg-tchannel
with default configurations below:
- tchannelModule: 'tchannel',
- cacheThriftTime:
0
thriftIDL cache millisecond, 0 => permanent - thriftIDLPath:
path.join(appInfo.baseDir, "thrift_idl")
- timeout:
2500
- thriftOptions:
strict:
false
allowOptionalArguments:true
// {app_root}/config/config.default.jsexportstchannel = // timeout: 2500,;
Usage
// {app_root}/app.js { thisapp = app; } async { // registry should return a promise, like: { return Promise; } thisapptchannel; } moduleexports = AppBootHook;
In controller, you can use app.tchannel.request
.
// app/controller/home.js module { return Controller async { const ctx app = this; const res = await apptchannel; ctxbody = res; } ;};
Questions & Suggestions
Please open an issue here.