# ctirobot_eureka

> company eureka config

Latest version **0.0.4** (published 2018-10-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install ctirobot_eureka
pnpm add ctirobot_eureka
yarn add ctirobot_eureka
bun add ctirobot_eureka
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2018-10-24 |
| First published | 2018-09-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | ctirobot |
| Maintainers | sukeming |

## Links

- npm: https://www.npmjs.com/package/ctirobot_eureka
- Repository: https://github.com/Sokkam/ctirobot_eureka
- Homepage: https://github.com/Sokkam/ctirobot_eureka#readme
- Issues: https://github.com/Sokkam/ctirobot_eureka/issues
- npm.io page: https://npm.io/package/ctirobot_eureka

## Dependencies (3)

- [util](https://npm.io/package/util.md) ^0.11.0
- [request](https://npm.io/package/request.md) ^2.88.0
- [eureka-js-client](https://npm.io/package/eureka-js-client.md) ^4.4.1

## Recent versions

- 0.0.4 (latest) — 2018-10-24
- 0.0.3 — 2018-10-19
- 0.0.2 — 2018-09-20
- 0.0.1 — 2018-09-20

## README

# ctirobot_eureka
[![npm](https://img.shields.io/npm/v/ctirobot_eureka.svg)](https://www.npmjs.com/package/ctirobot_eureka)
> 小弟在大佬的指导下，粗略的写了一个提供给我们自己使用的npm包，主要是用来将当前的服务注册到Spring Eureka上，主要是为了简化Eureka-js-client包的使用，并拿取公司的远程配置文件。
### 安装
```
npm install ctirobot_eureka
```

### 用法
```javascript
const ctirobotEureka = require('ctirobot_eureka');

async function getConfig() {

    config = ctirobotEureka.initConfig('myApp', 8080, 'myApp-service', 'eureka-server:8760', 'host');

    instances = await ctirobotEureka.getConfigInfo(config, 'config-server');

    // 根据instances获取到的服务内容，找到自己需要访问的url
    xxxJsonData = await ctirobotEureka.requestUrl(instances[0].homePageUrl, 'xxx-service');

    console.log(xxxJsonData);

}

getConfig();
```

### API
* 初始化一个Eureka的配置文件<br/>
```initConfig(appName, port, vipAddress, eurekaAddress)```<br/><br/>
* 获取注册中心某个服务的信息<br/>
```getConfigInfo(config, serverName)```<br/><br/>
* 根据要获取的文件去请求数据<br/>
```requestUrl(targetHost, targetConfigFileName)```

---
_Source: https://npm.io/package/ctirobot_eureka · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
