# @youpenglai/mfw

> consul api info

Latest version **1.2.4** (published 2019-06-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install @youpenglai/mfw
pnpm add @youpenglai/mfw
yarn add @youpenglai/mfw
bun add @youpenglai/mfw
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2019-06-28 |
| First published | 2019-03-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 27.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | wt |
| Maintainers | wentandota |
| Keywords | consul, penglai |

## Links

- npm: https://www.npmjs.com/package/@youpenglai/mfw
- npm.io page: https://npm.io/package/@youpenglai/mfw

## Dependencies (6)

- [grpc](https://npm.io/package/grpc.md) ^1.19.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.11
- [amqplib](https://npm.io/package/amqplib.md) ^0.5.3
- [request](https://npm.io/package/request.md) ^2.88.0
- [bluebird](https://npm.io/package/bluebird.md) ^3.5.3
- [@grpc/proto-loader](https://npm.io/package/@grpc/proto-loader.md) ^0.5.1

## Recent versions

- 1.2.4 (latest) — 2019-06-28
- 1.2.3 — 2019-06-20
- 1.2.2 — 2019-06-03
- 1.2.1 — 2019-06-03
- 1.2.0 — 2019-06-03
- 1.1.5 — 2019-04-28
- 1.1.4 — 2019-04-23
- 1.1.3 — 2019-04-22
- 1.1.2 — 2019-04-22
- 1.1.1 — 2019-04-19
- 1.1.0 — 2019-04-19
- 1.0.9 — 2019-04-19
- 1.0.8 — 2019-04-16
- 1.0.7 — 2019-04-16
- 1.0.6 — 2019-04-16
- … 5 more at https://npm.io/package/@youpenglai/mfw/versions

## README

# Consul

朋来私有 client.

## Documentation

### registry([options])

Initialize a new Consul client.

Options
 * port (required Integer): agent HTTP(S) port

Usage

``` javascript
const Registry = require('@penglai/mfw').Registry;
Registry.register({
    port: 3500,
    name: 'web11',
    check: {
        type: 'http or grpc'
    }
})

==> promise

Registry.discover(serviceName)
```
### server
``` javascript
const Server = require('@penglai/mfw').Server;
Server.add([{
    protoPath: '文件路径，绝对路径',
    package: '包名',
    serviceName: '方法名',
    methods: {
        fnName: handle
    },
}]);
Server.bind('0.0.0.0:50011');
Server.start();
```

### client
``` javascript
const Client = require('@penglai/mfw').Client;
const client = Client.create({
    ipAddress: 'localhost:60061',
    protoPath: '文件路径',
    package: '包名',
    serviceName: '方法名'
})
client.check()
.then(() => {
    
})
.catch(() => {
    
})
```

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