summary refs log tree commit diff
path: root/src/api/Server.ts
diff options
context:
space:
mode:
authorSamuel <34555296+Flam3rboy@users.noreply.github.com>2023-03-17 17:47:43 +0100
committerSamuel <34555296+Flam3rboy@users.noreply.github.com>2023-03-17 17:47:43 +0100
commit810f5dd84cab8249f90276ce3acde5ffe6938c8d (patch)
treed3937ad69408a3e4e924f6d52dc38a43db7a6ffb /src/api/Server.ts
parentfix: types when using yarn (diff)
downloadserver-810f5dd84cab8249f90276ce3acde5ffe6938c8d.tar.xz
perf: cache jwt secret as key
Diffstat (limited to 'src/api/Server.ts')
-rw-r--r--src/api/Server.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/api/Server.ts b/src/api/Server.ts
index 49229494..ced82dce 100644
--- a/src/api/Server.ts
+++ b/src/api/Server.ts
@@ -32,7 +32,7 @@ import "missing-native-js-functions";
 import morgan from "morgan";
 import path from "path";
 import { red } from "picocolors";
-import { Authentication, CORS } from "./middlewares/";
+import { CORS, initAuthentication } from "./middlewares/";
 import { BodyParser } from "./middlewares/BodyParser";
 import { ErrorHandler } from "./middlewares/ErrorHandler";
 import { initRateLimits } from "./middlewares/RateLimit";
@@ -97,7 +97,7 @@ export class FosscordServer extends Server {
 		// @ts-ignore
 		this.app = api;
 
-		api.use(Authentication);
+		initAuthentication(api);
 		await initRateLimits(api);
 		await initTranslation(api);
 
@@ -126,6 +126,10 @@ export class FosscordServer extends Server {
 		app.use("/api/v9", api);
 		app.use("/api", api); // allow unversioned requests
 
+		try {
+			require("./middlewares/TestClient").default(this.app);
+			// eslint-disable-next-line no-empty
+		} catch (error) {}
 		this.app.use(ErrorHandler);
 
 		Sentry.errorHandler(this.app);