🔧 Improvements: - Add /api/health endpoint for basic API functionality testing - Improve /api/test-db with timeout handling and better error reporting - Add environment variable checks before database operations - Add connection timeouts to prevent function timeouts - Better error handling and logging 🧪 Testing Endpoints: - /api/health - Simple API health check (no DB required) - /api/test-db - Database connectivity test with timeout protection These changes should help identify whether the issue is with API routing, environment variables, or database connectivity.
17 lines
526 B
TypeScript
17 lines
526 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
|
|
export default async function handler(req: NextRequest) {
|
|
return new NextResponse(JSON.stringify({
|
|
success: true,
|
|
message: 'API is working!',
|
|
timestamp: new Date().toISOString(),
|
|
environment: process.env.NODE_ENV || 'unknown',
|
|
has_database_url: !!process.env.DATABASE_URL,
|
|
has_jwt_secret: !!process.env.JWT_SECRET,
|
|
method: req.method,
|
|
url: req.url
|
|
}), {
|
|
status: 200,
|
|
headers: { 'Content-Type': 'application/json' },
|
|
});
|
|
}
|