# y-server-plugin-apm

> y-server api proxy/mock plugin

Latest version **0.0.1** (published 2017-08-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install y-server-plugin-apm
pnpm add y-server-plugin-apm
yarn add y-server-plugin-apm
bun add y-server-plugin-apm
```

## 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.1 |
| Published | 2017-08-02 |
| First published | 2017-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | SmadeyZhang |
| Maintainers | smadey |

## Links

- npm: https://www.npmjs.com/package/y-server-plugin-apm
- Repository: https://github.com/yued-fe/y-server-plugin-apm
- Homepage: https://github.com/yued-fe/y-server-plugin-apm#readme
- Issues: https://github.com/yued-fe/y-server-plugin-apm/issues
- npm.io page: https://npm.io/package/y-server-plugin-apm

## Dependencies (2)

- [colors](https://npm.io/package/colors.md) ^1.1.2
- [express-request-proxy](https://npm.io/package/express-request-proxy.md) ^2.0.0

## Recent versions

- 0.0.1 (latest) — 2017-08-02

## README

# y-server-plugin-apm

y-server-plugin-apm is a [y-server](https://github.com/yued-fe/y-server) plugin to proxy/mock api.

## Install

```bash
npm install y-server-plugin-apm
```

## Usage

```javascript
const path = require('path');

const yServer = require('y-server');
const apmPlugin = require('y-server-plugin-apm');

yServer({
  plugins: [
    apmPlugin({
      apiPaths: ['/majax/*'],

      proxyServer: 'http://m.readnovel.com',
      proxyOptions: {
        query: {},
        headers: {},
      },

      mockEnable: true,
      mockDir: path.join(__dirname, './json'),
      mockResultResolver: path.join(__dirname, './json/resultResolver.js'),
      throwMockError: true,
    }),
  ],
});
```

## Notes

* `apiPaths` is the Array which will be proxy/mock.
* `proxyServer` is the proxy server.
* `proxyOptions` is the proxy options (see [express-request-proxy](https://github.com/4front/express-request-proxy)).
* `mockEnable` is the mock switch.
* `mockDir` is the base directory of mock data.
* `mockResultResolver` is the handler of mock data.
* `throwMockError` is the switch of throw/proxy on mock error.

## License

[MIT License](http://en.wikipedia.org/wiki/MIT_License)

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