import { NextFunction , Request , Response } from 'express' ; export function wrapAsyncMiddleware ( fn ) { return async ( req ? , res ? , next ? ) => { try { const result = fn ( req , res , next ) ; if ( result ) { ( result as Promise < any > ) . catch ( next ) ; } } catch ( e ) { next ( e ) ; } } ; }