From 433c4e221698d204fd8ac92a10908219db2af4eb Mon Sep 17 00:00:00 2001 From: Hans Ott Date: Wed, 14 Feb 2024 17:50:27 +0100 Subject: [PATCH] Explain what Express wrapper does --- library/src/sources/Express.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/src/sources/Express.ts b/library/src/sources/Express.ts index e93767a1b..bed1a11a5 100644 --- a/library/src/sources/Express.ts +++ b/library/src/sources/Express.ts @@ -28,6 +28,10 @@ function createMiddleware(): Middleware { } export class Express implements Wrapper { + // Whenever app.get, app.post, etc. is called, we want to inject our middleware + // So that runWithContext is called for every request + // Whenever a MongoDB query is made, we want to inspect the filter + // And cross-reference it with the user supplied data of the request private wrapRouteMethods(exports: unknown) { massWrap( // @ts-expect-error This is magic that TypeScript doesn't understand