1.0.18 • Published 5 years ago
egg-eureka-client v1.0.18
egg-eureka-client
Install
$ npm i egg-eureka-client --save
Usage
// {app_root}/config/plugin.js
exports.eurekaClient = {
enable: true,
package: 'egg-eureka-client',
};
Configuration
// {app_root}/config/config.default.js
exports.eurekaClient = {
aws:true,
eureka: {
useLocalMetadata: true,
preferIpAddress: true,
serviceUrls: {
default: [
'http://reg1.oriente.internal:8761/eureka/',
'http://reg2.oriente.internal:8762/eureka/',
'http://reg3.oriente.internal:8763/eureka/'
]
}
}
};
see config/config.default.js for more detail.
Example
app.js
app.beforeStart(async () => {
app.eureka = app.eurekaFactory.createClient();
await app.eureka.ready(true);
app.eureka.updateRegistry();
}
// get
this.ctx.app.eureka.app('fe-shortlink-biz').get('/system/version').then( ret => {
console.log(ret && ret.body);
this.ctx.app.logger.info('[Eureka-Client] The systemVersion is :' + `${ret && ret.body}`);
});
// post
this.ctx.app.eureka.app('common-biz').post('/common/short_url/shorten/create', {data:{oriUrl : oriUrl}}).then( ret => {
console.log(ret && ret.body.data);
});
Questions & Suggestions
Please open an issue here.
License
1.0.18
5 years ago
1.0.17
5 years ago
1.0.16
5 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.13
5 years ago
1.0.12
5 years ago
1.0.11
5 years ago
1.0.10
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago
1.0.6
5 years ago
1.0.5
5 years ago
1.0.4
5 years ago
1.0.3
5 years ago
1.0.2
5 years ago
1.0.1
5 years ago
1.0.0
5 years ago