修复endpoints构建router时参数传错
This commit is contained in:
parent
6bf15a68b8
commit
7fa8782323
|
|
@ -116,9 +116,9 @@ async function startup(path, contextBuilder, connector, omitWatchers, omitTimers
|
|||
}
|
||||
});
|
||||
// 注入所有的endpoints
|
||||
const endpoints = appLoader.getEndpoints();
|
||||
const endpoints = appLoader.getEndpoints(connector.getEndpointRouter());
|
||||
endpoints.forEach(([name, method, url, fn]) => {
|
||||
router[method](name, url, async (ctx) => {
|
||||
router[method](url, async (ctx) => {
|
||||
const { req, request, params } = ctx;
|
||||
const { body, headers } = request;
|
||||
try {
|
||||
|
|
@ -132,7 +132,7 @@ async function startup(path, contextBuilder, connector, omitWatchers, omitTimers
|
|||
}
|
||||
});
|
||||
});
|
||||
router.get('/endpoint', async (ctx) => {
|
||||
router.get(connector.getEndpointRouter(), async (ctx) => {
|
||||
ctx.response.body = endpoints;
|
||||
});
|
||||
koa.use(router.routes());
|
||||
|
|
|
|||
|
|
@ -132,10 +132,10 @@ export async function startup<ED extends EntityDict & BaseEntityDict, Cxt extend
|
|||
});
|
||||
|
||||
// 注入所有的endpoints
|
||||
const endpoints = appLoader.getEndpoints();
|
||||
const endpoints = appLoader.getEndpoints(connector.getEndpointRouter());
|
||||
endpoints.forEach(
|
||||
([name, method, url, fn]) => {
|
||||
router[method](name, url, async (ctx) => {
|
||||
router[method](url, async (ctx) => {
|
||||
const { req, request, params } = ctx;
|
||||
const { body, headers } = request;
|
||||
try {
|
||||
|
|
@ -150,7 +150,8 @@ export async function startup<ED extends EntityDict & BaseEntityDict, Cxt extend
|
|||
});
|
||||
}
|
||||
);
|
||||
router.get('/endpoint', async (ctx) => {
|
||||
|
||||
router.get(connector.getEndpointRouter(), async (ctx) => {
|
||||
ctx.response.body = endpoints;
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue