From 7ff9aab0275b534e8cd8804f809d23b03e3067db Mon Sep 17 00:00:00 2001 From: Calum Muir Date: Mon, 22 Dec 2025 14:01:59 +0000 Subject: [PATCH] Return JSON for unmatched api routes --- src/worker.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/worker.ts b/src/worker.ts index 0282a1c..0a82cc2 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -189,6 +189,9 @@ export default { } return handleContact(request, env); } + if (url.pathname.includes("/api/")) { + return jsonResponse({ ok: false, error: "Not found." }, 404); + } if (env.ASSETS?.fetch) { return env.ASSETS.fetch(request); }