From d2a229ade2d96f138065c857c2a234de76f36933 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Thu, 4 Dec 2025 05:23:25 -0800 Subject: [PATCH] fix: handle API POST/PATCH/DELETE in fetch handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bun's routes object has issues with non-GET methods not being matched correctly. Handle these methods explicitly in the fetch handler. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/aggregator/index.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/aggregator/index.ts b/src/aggregator/index.ts index 4d537a9..e237d4f 100644 --- a/src/aggregator/index.ts +++ b/src/aggregator/index.ts @@ -148,6 +148,23 @@ export class BacklogAggregator { return new Response(htmlFile, { headers: { "Content-Type": "text/html" } }); } + // Handle API routes with non-GET methods (Bun routes object has issues with POST/PATCH/DELETE) + if (url.pathname.startsWith("/api/")) { + const method = req.method.toUpperCase(); + if (url.pathname === "/api/tasks/update" && method === "PATCH") { + return this.handleUpdateTask(req); + } + if (url.pathname === "/api/tasks/create" && method === "POST") { + return this.handleCreateTask(req); + } + if (url.pathname === "/api/tasks/archive" && method === "POST") { + return this.handleArchiveTask(req); + } + if (url.pathname === "/api/tasks/delete" && method === "DELETE") { + return this.handleDeleteTask(req); + } + } + return new Response("Not Found", { status: 404 }); }, websocket: {