UNPKG

@creamapi/cream

Version:

Concise REST API Maker - An extension library for express to create REST APIs faster

21 lines (20 loc) 1.17 kB
import 'reflect-metadata'; import { BaseMiddleware, BaseMiddlewares } from './ExpressMiddleware'; import { ExpressModule } from '../ExpressAdapter/ExpressModule'; /** * This decorator is used to create a stack of middlewares for a controller. <br> * This stack of middlewares is applied to all ExpressCalls in the controller * @param middlewares the middlewares that should be called before calling the endpoint * @returns a class that extends the target class and will initialize the middlewares */ export declare function UseMiddlewaresForController<T extends { new (...args: any[]): ExpressModule; }>(middlewares: BaseMiddlewares): (target: T) => T; /** * This decorator is used to push to the middleware stack a new middleware for the <br> * decorated ExpressCall. Middlewares pushed with this decorator will be executed with <br> * a top-down approach (like a stack) * @param middleware the middleware that should be pushed to the stack * @returns the actual decorator */ export declare function UseMiddleware<T extends BaseMiddleware>(middleware: T): (target: ExpressModule, propertyName: string, descriptor: PropertyDescriptor) => PropertyDescriptor;