Files
Automata/packages/cli/src/decorators/rest-controller.ts
Iván Ovejero f667b384c9 refactor(core): Standardize filenames in cli (no-changelog) (#10484)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2024-08-22 11:10:37 +02:00

13 lines
442 B
TypeScript

import { Service } from 'typedi';
import { getControllerMetadata } from './controller.registry';
import type { Controller } from './types';
export const RestController =
(basePath: `/${string}` = '/'): ClassDecorator =>
(target) => {
const metadata = getControllerMetadata(target as unknown as Controller);
metadata.basePath = basePath;
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Service()(target);
};