/** * This is a middleware used to validate current user. */ import { NextFunction, Request, Response } from "express"; interface userPayload { email: string; id?: string; } /** * TS does not understand any new property. * Using below coding section, we added a new property to the request object. */ declare global { namespace Express { interface Request { currentUser?: userPayload; } } } /** * Middleware validates if a user is logged in. * @param req * @param res * @param next */ declare const currentUserHandler: (req: Request, res: Response, next: NextFunction) => void; export { currentUserHandler };