import { NextFunction, Request, RequestHandler, Response } from "express"; export const rawBodyParser: RequestHandler = (req: Request, _res: Response, next: NextFunction) => { const chunks: any[] = []; req.on("data", function (data) { chunks.push(data); }); req.on("end", function () { req.body = Buffer.concat(chunks); next(); }); };