1.0.2 • Published 7 years ago

@svenardo/koa-proxy v1.0.2

Weekly downloads
22
License
ISC
Repository
-
Last release
7 years ago

Koa 2 Proxy

Installation

Get it from npm with npm install --save @svenardo/koa-proxy

Testing

const koaProxy = require('@svenardo/koa-proxy');
const Router = require('koa-router');
const router = new Router();

router.get("/octocat*", async ctx => 
  ctx.body = await koaProxy(ctx, {
  target: 'https://api.github.com/users',
  changeOrigin: true
  })
  .then(res => res)
  .catch(err => handleError(err))
)

License

ISC