Frontend/25_02_24/node_modules/milliparsec/dist/index.d.ts

16 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-02-25 08:55:29 +00:00
import type { EventEmitter } from 'node:events';
import type { IncomingMessage, ServerResponse as Response } from 'node:http';
type NextFunction = (err?: any) => void;
export type ReqWithBody<T = any> = IncomingMessage & {
body?: T;
} & EventEmitter;
export declare const hasBody: (method: string) => boolean;
export declare const p: <T = any>(fn: (body: any) => any) => (req: ReqWithBody<T>, _res: Response, next: (err?: any) => void) => Promise<any>;
declare const custom: <T = any>(fn: (body: any) => any) => (req: ReqWithBody, _res: Response, next: NextFunction) => Promise<void>;
declare const json: () => (req: ReqWithBody, res: Response, next: NextFunction) => Promise<void>;
declare const raw: () => (req: ReqWithBody, _res: Response, next: NextFunction) => Promise<void>;
declare const text: () => (req: ReqWithBody, _res: Response, next: NextFunction) => Promise<void>;
declare const urlencoded: () => (req: ReqWithBody, res: Response, next: NextFunction) => Promise<void>;
declare const multipart: () => (req: ReqWithBody, res: Response, next: NextFunction) => Promise<void>;
export { custom, json, raw, text, urlencoded, multipart };