route.ts 681 B

123456789101112131415161718192021222324252627
  1. import { NextResponse } from 'next/server';
  2. import { testFalConnection } from '@/lib/test-fal-connection';
  3. export async function GET() {
  4. try {
  5. const result = await testFalConnection();
  6. return NextResponse.json({
  7. ...result,
  8. timestamp: new Date().toISOString(),
  9. environment: process.env.NODE_ENV,
  10. });
  11. } catch (error) {
  12. console.error('Test connection error:', error);
  13. return NextResponse.json(
  14. {
  15. success: false,
  16. message: '连接测试失败',
  17. error: error instanceof Error ? error.message : '未知错误',
  18. timestamp: new Date().toISOString(),
  19. },
  20. { status: 500 }
  21. );
  22. }
  23. }