From 3cb5faf902f4d986043ef64b320d963493f3992c Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 3 Aug 2021 21:07:53 +0200 Subject: [PATCH] Add @Controller export to index.ts --- lib/decorators/controller.decorator.ts | 2 +- lib/index.ts | 2 ++ .../controllers-handlers-metadata.reader.spec.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/decorators/controller.decorator.ts b/lib/decorators/controller.decorator.ts index f59b1b8..60b64aa 100644 --- a/lib/decorators/controller.decorator.ts +++ b/lib/decorators/controller.decorator.ts @@ -1,6 +1,6 @@ import { CONTROLLER_PATTERN_METADATA } from '../constants/decorators'; -export function Controller(pattern: string): ClassDecorator { +export default function Controller(pattern: string): ClassDecorator { return (target) => { Reflect.defineMetadata(CONTROLLER_PATTERN_METADATA, pattern, target.prototype); }; diff --git a/lib/index.ts b/lib/index.ts index ecfb6eb..1685139 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -19,6 +19,8 @@ export * from './decorators/create-param-decorator'; export { default as createParamDecorator } from './decorators/create-param-decorator'; export * from './decorators/use-middleware.decorator'; export { default as UseMiddleware } from './decorators/use-middleware.decorator'; +export * from './decorators/controller.decorator'; +export { default as Controller } from './decorators/controller.decorator'; export * from './middleware/internal/param-transformer.middleware'; export { default as ParamTransformerMiddleware } from './middleware/internal/param-transformer.middleware'; diff --git a/test/unit/metadata-readers/controllers-handlers-metadata.reader.spec.ts b/test/unit/metadata-readers/controllers-handlers-metadata.reader.spec.ts index e365e84..a70f1a4 100644 --- a/test/unit/metadata-readers/controllers-handlers-metadata.reader.spec.ts +++ b/test/unit/metadata-readers/controllers-handlers-metadata.reader.spec.ts @@ -1,7 +1,7 @@ import 'reflect-metadata'; import { MessagePattern, UseMiddleware } from '../../../lib'; import Data from '../../../lib/decorators/data.decorator'; -import { Controller } from '../../../lib/decorators/controller.decorator'; +import Controller from '../../../lib/decorators/controller.decorator'; import { isHandlerParamMetadata } from '../../../lib/interfaces/handler-param-metadata.interface'; import { ControllerHandlersMetadataReader } from '../../../lib/metadata-readers/controller-handlers-metadata.reader'; import { MockMiddleware } from '../__mocks__/mock-middleware';