新增資料庫、用戶註冊、登入的功能

This commit is contained in:
2025-08-05 10:56:22 +08:00
parent 94e3763402
commit a288a966ba
41 changed files with 4362 additions and 289 deletions

35
app/api/route.ts Normal file
View File

@@ -0,0 +1,35 @@
import { NextRequest, NextResponse } from 'next/server';
import { db } from '@/lib/database';
export async function GET(request: NextRequest) {
try {
// 健康檢查
const isHealthy = await db.healthCheck();
if (!isHealthy) {
return NextResponse.json(
{ error: 'Database connection failed' },
{ status: 503 }
);
}
// 獲取基本統計
const stats = await db.getDatabaseStats();
return NextResponse.json({
message: 'AI Platform API is running',
version: '1.0.0',
timestamp: new Date().toISOString(),
database: {
status: 'connected',
stats
}
});
} catch (error) {
console.error('API Health Check Error:', error);
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
);
}
}