monkeytype/backend/middlewares/context.ts
Bruce Berrios 1ba7a76b86
Migrate middlewares to TypeScript (#2574)
* Migrate middlewares

* Update workflow

* Fix ignore

* Fix

* Fix

* Remove babel loader from root dependencies

* Remove mongoDb
2022-02-23 10:03:38 -05:00

22 lines
451 B
TypeScript

import ConfigurationDAO from "../dao/configuration";
import { Response, NextFunction } from "express";
async function contextMiddleware(
req: MonkeyTypes.Request,
_res: Response,
next: NextFunction
): Promise<void> {
const configuration = await ConfigurationDAO.getCachedConfiguration(true);
req.ctx = {
configuration,
decodedToken: {
uid: null,
email: null,
},
};
next();
}
export default contextMiddleware;