egg-jsonrpc-client
Install
$ npm i egg-jsonrpc-client --save
Usage
// {app_root}/config/plugin.jsexportsjsonrpcClient = enable: true package: 'egg-jsonrpc-client';
Configuration
Single instance:
exportsjsonrpcClient = client: foo: host: '' // required timeout: 5000 // default headers: // custom headers { return // return custom headers } { // before request hook } ;
Multiple instance:
exportsjsonrpcClient = clients: foo: // ... bar: // ...
see config/config.default.js for more detail.
Example
Single instance:
appjsonrpcClient
Multiple instance:
appjsonrpcClient
When
getHeaders
is set, you need to passctx
as the third argument when invoke the method.
License
MIT License