You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
566 B
24 lines
566 B
2 years ago
|
const proxy = require('koa-proxy');
|
||
|
const convert = require('koa-convert');
|
||
|
|
||
|
module.exports = {
|
||
|
entry(app, router, opts) {
|
||
|
app.use(convert(proxy({
|
||
|
host: opts.host,
|
||
|
match: opts.match,
|
||
|
map(path) {
|
||
|
return path.replace(opts.match, '');
|
||
|
},
|
||
|
})));
|
||
|
// Object.keys(opts).forEach((option) => {
|
||
|
// app.use(convert(proxy({
|
||
|
// host: opts[option].host,
|
||
|
// match: opts[option].match,
|
||
|
// map(path) {
|
||
|
// return path.replace(opts[option].match, '');
|
||
|
// },
|
||
|
// })));
|
||
|
// });
|
||
|
},
|
||
|
};
|