8000 GitHub - edorivai/koa-proxy at 0.1.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

edorivai/koa-proxy

Repository files navigation

koa-proxy Build Status Coverage Status

Proxy middleware for koa


Install

$ npm install koa-proxy -g

Usage

When you request http://localhost:3000/index.js, it will fetch http://alicdn.com/index.js and return.

var koa = require('koa');
var proxy = require('koa-proxy');
var app = koa();
app.use(proxy({
  host: 'http://alicdn.com'
}));
app.listen(3000);

You can proxy a specified url.

app.get('index.js', proxy({
  url: 'http://alicdn.com/index.js'
}));

You can specify a key/value object that can map your request's path to the other.

app.get('index.js', proxy({
  host: 'http://alicdn.com',
  map: {
    'index.js': 'index-1.js'
  }
}));

LISENCE

Copyright (c) 2014 popomore. Licensed under the MIT license.

About

Proxy middleware for koa

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%
0