#koa2-pixie-proxy ![Build Status](https://travis-ci.org/sc0ttyd/koa2-pixie-proxy.svg?branch=master)
A simple but flexible proxy middlware for koa2.
Forked from koa-pixie-proxy due to lack of support for Koa2.
Installation
npm i --save koa2-pixie-proxy
Usage
const pixie = require('koa2-pixie-proxy');
const Koa = require('koa');
const router = require('koa-router');
const app = new Koa();
app.use(router(app));
var proxy = pixie({host: 'http://example.com'});
app.get('/hurp', proxy('/durp'));
app.get('some/:param/here/:id', proxy('someother/:param/maybesomethingelse/:id/durp'));
app.post('/foobar', proxy());
To allow later middleware to modify the response, koa2-pixie-proxy
will
set response headers, status and body but won't actually send the result to the
client. This means you give up nice proxy pipelining, but you can do things like
modify the result of a proxy like this:
app.get('/hurp', proxy('/durp'), (ctx) => {
ctx.body.beans = 'baz';
});