我正试图在我的下台上写一份简单的《名册》请求书。 我写了一份GET申请,并做了罚款。
Here is my basic code.
import { NextRequest, NextResponse } from "next/server";
export async function POST(request: NextRequest) {
const body = await request.json();
return NextResponse.json(body);
};
Here is the error in my terminal: ⨯ SyntaxError: Unexpected non-whitespace character after JSON at position 31 at JSON.parse () at parseJSONFromBytes (node:internal/deps/undici/undici:5329:19) at successSteps (node:internal/deps/undici/undici:5300:27) at fullyReadBody (node:internal/deps/undici/undici:1447:9) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async specConsumeBody (node:internal/deps/undici/undici:5309:7) at async POST (webpack-internal:///(rsc)/./app/api/projects/route.ts:11:18) at async /Users/austinwilliams/Desktop/portfolio-react/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:63251
我试图去除 as子并等待,这将消除错误,但反应只是空话。 不能确定如何打断它是一种许诺,其职能需要作为整体。
When I remove the async await I get status 200 with an empty response object.