I am trying to run the code below, but it is not working. I think this is a scope problem, but I'm not sure how to fix this.
import CommonController from './CommonController';
import CategoryService from './category/Service.js';
class CategoryController extends CommonController {
  constructor() {
    super(CategoryService);
  }
}
export default new CategoryController();
// ===================CommonController==========================
export default class CommonController {
  constructor(service) {
    this.service = service;
  }
  async get () {
    console.log(this); // it returns undefined
  }
}
// ===================CategoryService==========================
import Category from './Category'
import dto from './dto'
class CategoryService extends CommonService {
  constructor() {
    super(Category, dto);
  }
}
export default new CategoryService();
// ===================CommonService==========================
export default class CommonService {
  constructor(model, dto) {
    this.model = model;
    this.dto = dto;
  }
 }
if a run:
import CategoryController from './CategoryController';
CategoryController.get()
the console.log in CommonController get function will print undefined
Am I doing something wrong?
 
     
    