mox

所属分类:代理服务器
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2021-09-21 16:28:21
上 传 者sh-1993
说明:  混合模拟和代理服务器-易于编程并在express上运行
(A hybrid mock and proxy server - easily programmable and runs on express)

文件列表:
.eslintignore (62, 2020-12-17)
.eslintrc.js (1832, 2020-12-17)
.flowconfig (533, 2020-12-17)
.nvmrc (7, 2020-12-17)
LICENSE (1066, 2020-12-17)
babel.config.js (481, 2020-12-17)
docs/ (0, 2020-12-17)
docs/API.md (7097, 2020-12-17)
flow-typed/ (0, 2020-12-17)
flow-typed/npm/ (0, 2020-12-17)
flow-typed/npm/express_v4.16.x.js (11929, 2020-12-17)
flow-typed/npm/jest_v24.x.x.js (34126, 2020-12-17)
jest.config.js (476, 2020-12-17)
package.json (1926, 2020-12-17)
src/ (0, 2020-12-17)
src/Actions.js (6995, 2020-12-17)
src/DefaultBodyHandler.js (2243, 2020-12-17)
src/MoxRouter.js (1672, 2020-12-17)
src/MoxServer.js (3384, 2020-12-17)
src/__mocks__/ (0, 2020-12-17)
src/__mocks__/mox-test-server.js (3356, 2020-12-17)
src/__tests__/ (0, 2020-12-17)
src/__tests__/MoxRouter-test.js (595, 2020-12-17)
src/__tests__/MoxServer-test.js (385, 2020-12-17)
src/__tests__/e2e-test.js (10380, 2020-12-17)
src/__tests__/mox-test-utils.js (1103, 2020-12-17)
src/base-transformers.js (2430, 2020-12-17)
src/index.js (123, 2020-12-17)
src/index.js.flow (199, 2020-12-17)
src/proxy-request.js (2368, 2020-12-17)
src/types.js (2477, 2020-12-17)
src/utils.js (1175, 2020-12-17)
yarn.lock (229697, 2020-12-17)

# Mox A [node.js](https://nodejs.org/en/) developer tool written on top of [express.js](https://expressjs.com/). Mox is a cross between a mock and a proxy server. See here for the [NPM package](https://www.npmjs.com/package/@confluentinc/mox) ## Why this exists Mox's purpose is to bridge the gap between mock server usage and live backend usage. Frontend development processes typically fall into one of two camps: - Build off of mock servers - Build off of a local or hosted development backend Mox is a tool that helps you use both at the same time. It also provides a few other APIs that make the second camp a lot easier. Some key features: - Read or modify requests/responses in-flight - Mock individual endpoints or set of endpoints - Express.js based routing and pattern matching ## Installation Install this package through [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com/lang/en/). `npm install @confluentinc/mox` ## The basics Here's a quick example of what it takes to configure the server, perform a simple mock, and get it running. ```javascript import { MoxServer } from '@confluentinc/mox'; const server = new MoxServer({ targetUrl: 'https://dev.server', listenPort: 3005 }); const router = server.getRouter(); router.get('/api/route-to-mock').mock({ foo: 'bar' }); server.start(); ``` Mox supports most common HTTP methods, including `HEAD`, `OPTIONS`, and `PATCH`. It also supports the `all` matcher from `express.js` which matches all methods. In the above example, `router.get` matches the same way `app.get` would in `express`. ## Documentation More detailed [API reference](docs/API.md)

近期下载者

相关文件


收藏者