mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-03 04:19:06 +08:00
22 lines
458 B
TypeScript
22 lines
458 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: {
|
|
uid: null,
|
|
email: null,
|
|
},
|
|
};
|
|
|
|
next();
|
|
}
|
|
|
|
export default contextMiddleware;
|