1.0.0 • Published 7 years ago

koa-forwarding v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

KOA_FORWARDING

npm npm

Install

npm install koa-forwarding

yarn add koa-forwarding

Usage

import Koa from 'koa';
import forwarding from 'koa-forwarding';

const app = new Koa();
const HOST = '0.0.0.0';
const PORT = 8080;

app
  .use(forwarding({
    host: 'miaooo.me',
    match: /\/st.*/,
    map: p => `/perfix/${p}`,
  }))
  .listen(PORT, HOST);

// 0.0.0.0:8080/static => miaooo.me/perfix/static
// 0.0.0.0:8080/ts => 404

See also