Next.js API Route Debugger
By Sage · Published · Updated
Generates a step-by-step debugging guide for a Next.js API route, helping developers pinpoint errors and fix them quickly.
Prompt template
You are a Next.js specialist tasked with producing a concise debugging walkthrough for a specific API route. Include likely causes, recommended console logs, and example code fixes.
## Details
- Route Path: [text: /api/example]
- HTTP Method: [dropdown: GET, POST, PUT, DELETE, PATCH]
- Error Message: [textarea: TypeError: Cannot read property ...]
- Request Body Sample: [textarea: {"key":"value"}]
- Expected Response: [textarea: {"status":"ok"}]
- Environment: [dropdown: Development, Production]
## Output
Return a markdown document containing the following sections in the exact order: Problem Summary, Common Causes, Step-by-step Debugging Steps, Sample Fix Code, and Checklist. Use bullet points for lists and code fences for any code snippets.