🔧 API Route Format: - Add /api/simple.js using standard Vercel function format - Add /api/hello.ts using proper Next.js API route format - Install Next.js and types for proper API route support 🧪 Testing Multiple Formats: - JavaScript endpoint: /api/simple.js - TypeScript endpoint: /api/hello.ts - Both use traditional req/res pattern instead of NextRequest/NextResponse This should help identify the correct API format for Vercel functions.
20 lines
No EOL
477 B
TypeScript
20 lines
No EOL
477 B
TypeScript
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
|
|
type Data = {
|
|
message: string;
|
|
timestamp: string;
|
|
environment: string;
|
|
has_database_url: boolean;
|
|
}
|
|
|
|
export default function handler(
|
|
req: NextApiRequest,
|
|
res: NextApiResponse<Data>
|
|
) {
|
|
res.status(200).json({
|
|
message: 'Hello from TCG Vault API!',
|
|
timestamp: new Date().toISOString(),
|
|
environment: process.env.NODE_ENV || 'unknown',
|
|
has_database_url: !!process.env.DATABASE_URL
|
|
});
|
|
}
|