29 lines
710 B
TypeScript

import { NextResponse } from 'next/server'
import { testS3Connection } from '@/lib/s3'
// 存储连通性测试API
export async function GET() {
try {
// 测试S3连接
const s3Connected = await testS3Connection()
if (s3Connected) {
return NextResponse.json({
success: true,
message: 'S3存储服务连接正常'
})
} else {
return NextResponse.json({
success: false,
message: 'S3存储服务连接失败'
}, { status: 500 })
}
} catch (error) {
console.error('存储连通性测试失败:', error)
return NextResponse.json({
success: false,
message: '存储服务连接失败'
}, { status: 500 })
}
}