huridocs/uwazi

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

Summary

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

const multitenantMiddleware = (req: Request, _res: Response, next: NextFunction) => {
  appContext.set('tenant', req.get('tenant') || config.defaultTenant.name);
  next();
};

export { multitenantMiddleware };