Return JSON for unmatched api routes

This commit is contained in:
Calum Muir 2025-12-22 14:01:59 +00:00
parent 72a1dc6541
commit 7ff9aab027

View file

@ -189,6 +189,9 @@ export default {
} }
return handleContact(request, env); return handleContact(request, env);
} }
if (url.pathname.includes("/api/")) {
return jsonResponse({ ok: false, error: "Not found." }, 404);
}
if (env.ASSETS?.fetch) { if (env.ASSETS?.fetch) {
return env.ASSETS.fetch(request); return env.ASSETS.fetch(request);
} }