Streamline API Error Handling - Next.js
Created by Prompts-GPT
Refactor all API routes in app/api/ to use a centralized error handler in src/lib/error.ts. Replace raw SQL with Prisma methods, handle errors with try-catch, and return consistent JSON error responses (e.g., { error: 'Invalid input', status: 400 }). Use TypeScript and trigger npm run build to verify.
Category: development
Tags: