(fn: AsyncFunction)
| 14 | |
| 15 | |
| 16 | export const asyncHandler = (fn: AsyncFunction) => { |
| 17 | return (req: Request, res: Response, next: NextFunction) => { |
| 18 | Promise.resolve(fn(req, res, next).catch(next)) |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | export const authService = { |
| 23 | //register a new user: |