All files / common/decorators/core controller.decorator.ts

100% Statements 6/6
100% Branches 2/2
100% Functions 2/2
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 141x 1x           1x 11x 11x 11x      
import { isUndefined } from '../../utils/shared.utils';
import { PATH_METADATA } from '../../constants';
 
/**
 * Defines the Controller. The controller can inject dependencies through constructor.
 * Those dependencies have to belong to the same module.
 */
export function Controller(prefix?: string): ClassDecorator {
  const path = isUndefined(prefix) ? '/' : prefix;
  return (target: object) => {
    Reflect.defineMetadata(PATH_METADATA, path, target);
  };
}