···
import { setupDbWithMigrations } from "@/db";
import { DB_URL, SERVER_PORT } from "@/lib/env";
import { routes } from "@/routes";
import { setupServer } from "@/server";
···
const server = await setupServer();
for (const [url, route] of Object.entries(routes)) {
-
const { handler, method } = route;
-
const { wsHandler, method, handler, preHandler } = route;
-
handler: handler ?? (() => new Response()),
···
import { setupDbWithMigrations } from "@/db";
import { DB_URL, SERVER_PORT } from "@/lib/env";
+
import { newErrorResponse } from "@/lib/utils/http/responses";
+
wrapHttpRegistrationCheck,
+
wrapWsRegistrationCheck,
+
} from "@/lib/utils/registration";
import { routes } from "@/routes";
import { setupServer } from "@/server";
···
const server = await setupServer();
for (const [url, route] of Object.entries(routes)) {
+
const { handler, method, skipRegistrationCheck } = route;
+
handler: skipRegistrationCheck
+
: wrapHttpRegistrationCheck(handler),
+
skipRegistrationCheckHttp,
+
skipRegistrationCheckWs,
+
newErrorResponse(404, {
+
"This is a websocket only route. Did you mean to initiate a websocket connection here?",
+
handler: skipRegistrationCheckHttp
+
: wrapHttpRegistrationCheck(handler),
+
wsHandler: skipRegistrationCheckWs
+
: wrapWsRegistrationCheck(wsHandler),