From 68b1d5cc517f75e88fba4d386a6f0780a207f6a6 Mon Sep 17 00:00:00 2001 From: sirpiglr <49359077-sirpiglr@users.noreply.replit.com> Date: Wed, 3 Dec 2025 19:01:14 +0000 Subject: [PATCH] Add logging for post creation API requests and responses Adds console logs to the /api/posts endpoint in server/index.ts to capture incoming payloads and successful post creation data, aiding in debugging. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: f65c3e3d-c2a9-489d-b74e-9278ae76aed3 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/zMxtXds Replit-Helium-Checkpoint-Created: true --- server/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/index.ts b/server/index.ts index 74b595d7..6a2c2de2 100644 --- a/server/index.ts +++ b/server/index.ts @@ -2451,10 +2451,13 @@ export function createServer() { }); app.post("/api/posts", async (req, res) => { + console.log("[API] POST /api/posts called"); const payload = req.body || {}; + console.log("[API] Payload:", JSON.stringify(payload).slice(0, 200)); // Validation if (!payload.author_id) { + console.log("[API] Error: author_id is required"); return res.status(400).json({ error: "author_id is required" }); } if ( @@ -2523,6 +2526,7 @@ export function createServer() { .json({ error: error.message || "Failed to create post" }); } + console.log("[API] Post created successfully:", data?.id); res.json(data); } catch (e: any) { console.error("[API] /api/posts exception:", e?.message || String(e));