···
import { setupDbWithMigrations } from "@/db";
import { DB_URL, SERVER_PORT } from "@/lib/env";
3
+
import { newErrorResponse } from "@/lib/utils/http/responses";
5
+
wrapHttpRegistrationCheck,
6
+
wrapWsRegistrationCheck,
7
+
} from "@/lib/utils/registration";
import { routes } from "@/routes";
import { setupServer } from "@/server";
···
const server = await setupServer();
for (const [url, route] of Object.entries(routes)) {
12
-
const { handler, method } = route;
17
+
const { handler, method, skipRegistrationCheck } = route;
21
+
handler: skipRegistrationCheck
23
+
: wrapHttpRegistrationCheck(handler),
19
-
const { wsHandler, method, handler, preHandler } = route;
29
+
handler: httpHandler,
31
+
skipRegistrationCheckHttp,
32
+
skipRegistrationCheckWs,
38
+
newErrorResponse(404, {
40
+
"This is a websocket only route. Did you mean to initiate a websocket connection here?",
24
-
handler: handler ?? (() => new Response()),
47
+
handler: skipRegistrationCheckHttp
49
+
: wrapHttpRegistrationCheck(handler),
50
+
wsHandler: skipRegistrationCheckWs
52
+
: wrapWsRegistrationCheck(wsHandler),