Below is the code snippet I am working with:
class FeedbackController {
public homePage(req, res){
this.test();
res.send('Welcome to feedback service');
}
private test(){
console.log('test called');
}
}
export default new FeedbackController();
This is how I am calling it in my project:
import FeedbackController from '../controller/feedbackController';
const routes = (app) => {
app.route('/')
.get(FeedbackController.homePage);
};
export default routes;
However, I encountered the following error:
TypeError: Cannot read property 'test' of undefined
I'm unsure about what is causing this issue. Can someone help me figure out what's wrong?