huridocs/uwazi

View on GitHub
app/api/utils/requestIdMiddleware.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { Request, Response, NextFunction } from 'express';
import { appContext } from 'api/utils/AppContext';

const requestIdMiddleware = (_req: Request, _res: Response, next: NextFunction) => {
  appContext.set('requestId', Math.floor(Math.random() * 10000));
  next();
};

export { requestIdMiddleware };