ette-proxy
v1.0.3
Published
[![Build Status](https://travis-ci.org/boycgit/ette-proxy.svg?branch=master)](https://travis-ci.org/boycgit/ette-proxy) [![Coverage Status](https://coveralls.io/repos/github/boycgit/ette-proxy/badge.svg?branch=master)](https://coveralls.io/github/boycgit/
Downloads
13
Readme
ette-proxy
Proxy middleware for ette. inspired by http-proxy-middleware
- written in Typescript
- used with koa style
- fully tested
Installation
Node.js / Browserify
npm install ette-proxy --save
var proxy = require('ette-proxy');
Global object
Include the pre-built script.
<script src="./dist/index.umd.min.js"></script>
Build & test
npm run build
npm test
Usage
param
notice
as the mechanism of middleware, you should always put proxy middleware before your router middleware:
right way:
// 需要先挂载代理中间件,否则就错过了
app.use(proxy(proxyConfig));
// 然后再挂载路由
app.use(router.routes());
incorrect way:(will not proxy the router.routes())
// 先挂载挂载路由
app.use(router.routes());
// 后续挂载的代理功能对上述路由就不适用了
app.use(proxy(proxyConfig));
document
npm run doc
then open the generated out/index.html
file in your browser.
License
MIT.