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: {