fix: handle API POST/PATCH/DELETE in fetch handler
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 <noreply@anthropic.com>
This commit is contained in:
parent
bcd3c30f92
commit
d2a229ade2
|
|
@ -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: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue