add queryRoute for only return code data message

This commit is contained in:
2024-11-26 19:25:43 +08:00
parent 7f369b7b07
commit e0c7d40a9c
4 changed files with 85 additions and 8 deletions

View File

@@ -82,10 +82,13 @@ export class App<T = {}> {
}
return new Route(path, key, opts);
}
async call(message: { path: string; key: string; payload?: any }, ctx?: RouteContext & { [key: string]: any }) {
async call(message: { path: string; key?: string; payload?: any }, ctx?: RouteContext & { [key: string]: any }) {
const router = this.router;
return await router.call(message, ctx);
}
async queryRoute(path: string, key?: string, payload?: any, ctx?: RouteContext & { [key: string]: any }) {
return await this.router.queryRoute({ path, key, payload }, ctx);
}
exportRoutes() {
return this.router.exportRoutes();
}