UNPKG

ts5deco-express-controller

Version:

TypeScript 5 Modern Decorator Express Controller Framework

67 lines 1.99 kB
import { MiddlewareFunction } from '../types'; /** * 미들웨어를 적용하는 데코레이터 - TypeScript 5 Modern Decorator * * @param middlewares - 적용할 미들웨어 함수들 * @returns 메서드 데코레이터 * * @example * ```typescript * @Use(authMiddleware, loggingMiddleware) * @Get('/protected') * async getProtectedData() { * // ... * } * ``` */ export declare function Use(...middlewares: MiddlewareFunction[]): (target: any, context: ClassMethodDecoratorContext) => void; /** * 인증이 필요한 라우트임을 나타내는 데코레이터 * 실제 인증 미들웨어는 사용자가 제공해야 함 * * @param authMiddleware - 인증 미들웨어 함수 * @returns 메서드 데코레이터 * * @example * ```typescript * @Authenticated(jwtAuthMiddleware) * @Get('/profile') * async getProfile() { * // ... * } * ``` */ export declare function Authenticated(authMiddleware: MiddlewareFunction): (target: any, context: ClassMethodDecoratorContext) => void; /** * 권한 확인이 필요한 라우트임을 나타내는 데코레이터 * * @param authorizeMiddleware - 권한 확인 미들웨어 함수 * @returns 메서드 데코레이터 * * @example * ```typescript * @Authorized(adminOnlyMiddleware) * @Delete('/admin/users/:id') * async deleteUser() { * // ... * } * ``` */ export declare function Authorized(authorizeMiddleware: MiddlewareFunction): (target: any, context: ClassMethodDecoratorContext) => void; /** * 요청 검증이 필요한 라우트임을 나타내는 데코레이터 * * @param validationMiddleware - 검증 미들웨어 함수 * @returns 메서드 데코레이터 * * @example * ```typescript * @Validated(validateUserSchema) * @Post('/users') * async createUser() { * // ... * } * ``` */ export declare function Validated(validationMiddleware: MiddlewareFunction): (target: any, context: ClassMethodDecoratorContext) => void; //# sourceMappingURL=middleware.d.ts.map