monkeytype/backend/middlewares/context.ts
Bruce Berrios 3240abc22e
Enable strict null checks in backend (#2639)
* Enable strict null checks in backend

* Fix

* Use non-null assertion

* Add none
2022-03-07 11:10:07 -05:00

23 lines
474 B
TypeScript

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