const controllers = import.meta.glob('../../components/**/index.(js|jsx)', {
  eager: true
});

Object.keys(controllers).forEach(path => {
  const mod = controllers[path].default;
  if (mod) {
    const splittedPath = path.split('/');
    const identifier = splittedPath[splittedPath.length - 2];
    app.register(identifier, controllers[path].default);
  }
});