UNPKG

@catbee/utils

Version:

A modular, production-grade utility toolkit for Node.js and TypeScript, designed for robust, scalable applications (including Express-based services). All utilities are tree-shakable and can be imported independently.

40 lines 2.06 kB
import "reflect-metadata"; export interface Request { query: any; params: any; body?: any; [key: string]: any; } export interface Response { json: (body: any) => void; headersSent: boolean; [key: string]: any; } export type NextFunction = (err?: any) => void; export type RequestHandler = (req: Request, res: Response, next: NextFunction) => any; export interface Router { [method: string]: (path: string, ...handlers: RequestHandler[]) => void; } export type HttpMethod = "get" | "post" | "put" | "patch" | "delete" | "options" | "head" | "trace" | "connect"; export declare const Get: (path: string) => MethodDecorator; export declare const Post: (path: string) => MethodDecorator; export declare const Put: (path: string) => MethodDecorator; export declare const Patch: (path: string) => MethodDecorator; export declare const Delete: (path: string) => MethodDecorator; export declare const Options: (path: string) => MethodDecorator; export declare const Head: (path: string) => MethodDecorator; export declare const Trace: (path: string) => MethodDecorator; export declare const Connect: (path: string) => MethodDecorator; export declare function Controller(basePath: string): ClassDecorator; export declare function Use(...middlewares: RequestHandler[]): MethodDecorator; export declare const Query: (paramKey?: string) => ParameterDecorator; export declare const Param: (paramKey?: string) => ParameterDecorator; export declare const Body: (paramKey?: string) => ParameterDecorator; export declare const Req: (paramKey?: string) => ParameterDecorator; export declare const Res: (paramKey?: string) => ParameterDecorator; export declare function HttpCode(status: number): MethodDecorator; export declare function Header(name: string, value: string): MethodDecorator; export declare function Before(fn: Function): MethodDecorator; export declare function After(fn: Function): MethodDecorator; export declare function registerControllers(router: Router, controllers: any[]): void; //# sourceMappingURL=decorators.utils.d.ts.map