From db15dfaf5eaa200f4b547924db05fce8b7189a50 Mon Sep 17 00:00:00 2001 From: Dotta Date: Sat, 7 Mar 2026 15:15:51 -0600 Subject: [PATCH] fix(server): return 404 JSON for unmatched API routes Add catch-all handler after API router to return a proper 404 JSON response instead of falling through to the SPA handler. Co-Authored-By: Claude Opus 4.6 --- server/src/app.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/app.ts b/server/src/app.ts index 1faab285..5ce4e292 100644 --- a/server/src/app.ts +++ b/server/src/app.ts @@ -121,6 +121,9 @@ export async function createApp( }), ); app.use("/api", api); + app.use("/api", (_req, res) => { + res.status(404).json({ error: "API route not found" }); + }); const __dirname = path.dirname(fileURLToPath(import.meta.url)); if (opts.uiMode === "static") {