Next.js
Next.js Route Handlers:在 App Router 中构建高性能 RESTful API 与 Webhooks
Waitwalker2026-08-2912 min
## 1. 标准 Route Handler 定义
```typescript
// app/api/chat/route.ts
import { NextResponse } from 'next/server';
export async function POST(request: Request) {
const body = await request.json();
return NextResponse.json({ message: "Echo", data: body });
}
```
#Next.js#Route Handlers#REST API#Webhooks
回到文章列表 →