在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:KualiCo/koa-pixie-proxy开源软件地址:https://github.com/KualiCo/koa-pixie-proxy开源编程语言:JavaScript 100.0%开源软件介绍:#pixie-proxy A dirt-simple composable koajs proxy. Installationnpm i --save koa-pixie-proxy Usagevar pixie = require('koa-pixie-proxy');
var koa = require('koa');
var router = require('koa-router');
var app = koa();
app.use(router(app));
var proxy = pixie({host: 'http://example.com'});
// Proxy requests to server/hurp to example.com/durp
app.get('/hurp', proxy('/durp'));
// works with url params as long as they match the url params
// in the request to your server
app.get('some/:param/here/:id', proxy('someother/:param/maybesomethingelse/:id/durp'));
// if you leave out a url it proxies to host + this.url
app.post('/foobar', proxy()); To allow later middleware to modify the response, app.get('/hurp', proxy('/durp'), function*() {
// add a property to the body already proxied
this.body.beans = 'baz'
}); |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论