T
TanStack•6mo ago
rival-black

Unable to get JSON in Post API Route

I am doing the following in a POST API Routes handler:
export const APIRoute = createAPIFileRoute("/api/test")({
POST: async ({ request }) => {
const body = await request.json();
console.log(body);
return json({ message: "Hello" });
},
});
export const APIRoute = createAPIFileRoute("/api/test")({
POST: async ({ request }) => {
const body = await request.json();
console.log(body);
return json({ message: "Hello" });
},
});
And it never logs and gets stuck on awaiting the request.json(). I have my Content-Type header set. Any ideas?
1 Reply
rival-black
rival-blackOP•6mo ago
Figured it out, it was because I was running the server with Bun (bunx --bun vinxi dev --port 3030). Running it with Node fixed the issue 😭

Did you find this page helpful?