# ys-micro

> micro base on net.socket

Latest version **1.0.5** (published 2018-03-24) · 0 weekly downloads

## Install

```sh
npm install ys-micro
pnpm add ys-micro
yarn add ys-micro
bun add ys-micro
```

## 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.0.5 |
| Published | 2018-03-24 |
| First published | 2018-03-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | evio |

## Links

- npm: https://www.npmjs.com/package/ys-micro
- Repository: https://github.com/yskit/ys-micro
- Homepage: https://github.com/yskit/ys-micro#readme
- Issues: https://github.com/yskit/ys-micro/issues
- npm.io page: https://npm.io/package/ys-micro

## Dependencies (1)

- [koa-compose](https://npm.io/package/koa-compose.md) ^4.0.0

## Recent versions

- 1.0.5 (latest) — 2018-03-24
- 1.0.4 — 2018-03-21
- 1.0.3 — 2018-03-20
- 1.0.2 — 2018-03-20
- 1.0.1 — 2018-03-20
- 1.0.0 — 2018-03-20

## README

# ys-micro

[YS](https://github.com/yskit/ys-mutify) 架构之微服务启动架构。

# Install

```bash
npm install ys-micro --save
```

# Usage

```javascript
const Micro = require('ys-micro');
```

## Server Side

```javascript
const Service = require('ys-micro').Server;
const server = new Service();
server.use(async (ctx, next) => {
  console.log('url', ctx.url);
  console.log('data', ctx.data);
  ctx.body = 'receive';
});
server.listen(6000, err => {
  if (err) return console.error(err.message);
  console.log('net server start on 127.0.0.1:6000');
});
```

## Client Side

```javascript
const Client = require('ys-micro').Client;
Client('127.0.0.1:6000/path/to/1222/reply', {
  a: 1,
  b: 2
}).then(console.log).catch(console.error);
```

# License

It is [MIT licensed](https://opensource.org/licenses/MIT).

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