Files
EME_APP/eme-backend/src/middlewares/current-user.ts
T
2026-07-23 12:35:21 +02:00

11 lines
379 B
TypeScript

import { Request, Response, NextFunction } from 'express';
import { authenticateUser } from '../services/authentication.service';
export async function currentUser(req: Request, _res: Response, next: NextFunction): Promise<void> {
req.user = await authenticateUser({
authorization: req.header('authorization'),
demoEmail: req.header('x-user-email'),
});
next();
}