Sequence NODE_210
MediumCreate Dynamic API Route
Next.js
Node.js
JavaScript
Technical Specification
Build a dynamic API route that reads an id from the URL and returns fake data.
Input/Output Samples
Input:/api/users/123
Output:{ id: '123' }
Optimal Logic Path
// app/api/users/[id]/route.ts
export function GET(_req, { params }) {
return Response.json({ id: params.id });
}Architectural Deep-Dive
Dynamic API routes parallel page dynamic segments and share the same param system.