UNPKG

reest

Version:

A library inspired by NestJS's elegance, specifically designed for efficient serverless API development on AWS Lambda. It streamlines the creation of microservices with automated Swagger documentation and enhanced decorator-based middleware support, makin

23 lines (20 loc) 545 B
import { Interceptor } from "../../types"; export function UseGlobalInterceptor(interceptor: { new (): Interceptor; }): ClassDecorator { return (target: any) => { const currentInterceptors = Reflect.getMetadata( "GlobalInterceptors", target ); if (currentInterceptors?.length > 0) { Reflect.defineMetadata( "GlobalInterceptors", [...currentInterceptors, interceptor], target ); } else { Reflect.defineMetadata("GlobalInterceptors", [interceptor], target); } }; }