MCPcopy Create free account
hub / github.com/monkeytypegame/monkeytype / contextMiddleware

Function contextMiddleware

backend/src/middlewares/context.ts:22–39  ·  view source on GitHub ↗

* Add the context to the request * @param req * @param _res * @param next

(
  req: ExpressRequest,
  _res: Response,
  next: NextFunction,
)

Source from the content-addressed store, hash-verified

20 * @param next
21 */
22async function contextMiddleware(
23 req: ExpressRequest,
24 _res: Response,
25 next: NextFunction,
26): Promise<void> {
27 const configuration = await getCachedConfiguration(true);
28
29 (req as ExpressRequestWithContext).ctx = {
30 configuration,
31 decodedToken: {
32 type: "None",
33 uid: "",
34 email: "",
35 },
36 };
37
38 next();
39}
40
41export default contextMiddleware;

Callers

nothing calls this directly

Calls 1

getCachedConfigurationFunction · 0.90

Tested by

no test coverage detected