Is there a way to automatically initialize a class when a specific decorator is present above the class? For example:
@apiController
export class usersControllers extends lib.baseClasses.apiControllerBase().apiController {
@lib.decorators.routesRegister().register({ "url": "/login","isLoginUrl":true})
public postLoginUser($data) {
let userDetails = {
name: 'John Doe',
userType: '1', // required
age: '30',
tokenExpiry:5000000 // required
};
setTimeout(() => {
this.ok(userDetails);
}, 100);
return this.promise;
}
}
In the given example, I want the @apiController
decorator to automatically initialize the class. Can anyone assist me with resolving this issue?