🐛 Bug Fix: - Replace req.json() with req.text() + JSON.parse() for Vercel compatibility - Add proper error handling for malformed JSON requests - Fix authentication endpoints (login/register) body parsing - Fix admin users endpoint body parsing 🔧 Technical Details: - Vercel functions don't support req.json() method directly - Use req.text() to get raw body content then parse manually - Add try/catch blocks for JSON parsing errors - Maintain same API interface and error responses ✅ Endpoints Fixed: - /api/auth/register - User registration - /api/auth/login - User authentication - /api/admin/users - Admin user management This resolves the 'req.json is not a function' error in production. |
||
|---|---|---|
| .. | ||
| users.ts | ||