处理程序类具有试图通过传递必需的参数来调用的过程,但看来我做不到,在以下情况下,什么方法正确?
为什么我不能在main中执行GetAccountBalanceHandler .process?
handler.ts
export class GetAccountBalanceHandler extends Controller {
public static async process(@Request() request: any,
response: any): Promise<any> {
try {
const instance = new GetAccountBalanceHandler();
const data = await instance.execute(request);
response.status(200);
response.send(data);
} catch (err) {
response.status(200);
response.send(err.message);
}
}
constructor() {
super();
}
// execute stuff
}
main.ts
import {handler} "./handler"
export class GetAccountBalanceController extends Controller {
public static async process(@Request() request: ExpressRequest,
response: ExpressResponse): Promise<any> {
try {
const instance = new GetAccountBalanceController();
const data = await this.BalanceResponse(request);
response.status(200);
response.send(data);
} catch (err) {
response.status(200);
response.send(err.message);
}
}
constructor() {
super();
}
private async BalanceResponse(_request: any): Promise<any> {
return await GetAccountBalanceHandler .process(_request);
}
}