I have created the Controller abstract class with the abstract method executeImpl
, once I instantiate it and run
const exampleController = new ExampleController;
exampleController.execute(req, res);
In the classes that I have extended this abstract class the executeImpl
method is implemented
The error appears that:
TypeError: this.executeImpl is not a function
export abstract class Controller {
protected abstract executeImpl(
req: NextApiRequest,
res: NextApiResponse
): void | any;
public async execute(
req: NextApiRequest,
res: NextApiResponse
): Promise<void> {
try {
await this.executeImpl(req, res);
} catch (err) {
console.log(req.url);
console.error(err);
}
}
}
It doesn’t seem to recognize it within this