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 <noreply@anthropic.com>
This commit is contained in:
Dotta
2026-03-07 15:15:51 -06:00
parent 9ac2e71187
commit db15dfaf5e

View File

@@ -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") {