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:
@@ -121,6 +121,9 @@ export async function createApp(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
app.use("/api", api);
|
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));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
if (opts.uiMode === "static") {
|
if (opts.uiMode === "static") {
|
||||||
|
|||||||
Reference in New Issue
Block a user