实现了bridge接口
This commit is contained in:
parent
5d91dace5a
commit
650bf2333f
|
|
@ -71,6 +71,15 @@ async function startup(path, contextBuilder, connector, omitWatchers, omitTimers
|
||||||
ctx.response.body = body;
|
ctx.response.body = body;
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
// 桥接访问外部资源的入口
|
||||||
|
router.get(connector.getBridgeRouter(), async (ctx) => {
|
||||||
|
const { request: { querystring }, response } = ctx;
|
||||||
|
const { url, headers } = connector.parseBridgeRequestQuery(querystring);
|
||||||
|
// headers待处理
|
||||||
|
const res = await fetch(url);
|
||||||
|
response.body = res.body;
|
||||||
|
return;
|
||||||
|
});
|
||||||
// 注入所有的endpoints
|
// 注入所有的endpoints
|
||||||
const endpoints = appLoader.getEndpoints();
|
const endpoints = appLoader.getEndpoints();
|
||||||
const endpointsArray = [];
|
const endpointsArray = [];
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,17 @@ export async function startup<ED extends EntityDict & BaseEntityDict, Cxt extend
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 桥接访问外部资源的入口
|
||||||
|
router.get(connector.getBridgeRouter(), async (ctx) => {
|
||||||
|
const { request: { querystring }, response } = ctx;
|
||||||
|
const { url, headers } = connector.parseBridgeRequestQuery(querystring);
|
||||||
|
|
||||||
|
// headers待处理
|
||||||
|
const res = await fetch(url as string);
|
||||||
|
response.body = res.body;
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
|
||||||
// 注入所有的endpoints
|
// 注入所有的endpoints
|
||||||
const endpoints = appLoader.getEndpoints();
|
const endpoints = appLoader.getEndpoints();
|
||||||
const endpointsArray: [string, string, string][] = [];
|
const endpointsArray: [string, string, string][] = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue