I'm doing an express app with typescript. The router code is:
let user = new User();
router.get("/", user.test);
the user class is
export class User {
test(req, res, next) {
// this === undefined
}
}
the problem is that the this object is undefined inside test method. Is there a better way to implement express routing?