https://supertokens.com/ logo
#support-questions
Title
# support-questions
z

ZeferiniX

09/10/2021, 1:56 PM
Copy code
ts
import { RequestHandler, Request, Response, NextFunction } from 'express';

export const asyncHandler = (fn: RequestHandler) => {
  return async (req: Request, res: Response, next: NextFunction): Promise<void> => {
    try {
      await fn(req, res, next);
      next();
    } catch (err) {
      next(err);
    }
  };
};