Разработка интерфейса фронт

This commit is contained in:
iv_vuytsik
2025-09-05 03:16:17 +03:00
parent 6c2ea027a4
commit 4d6b7b48d7
35 changed files with 3806 additions and 276 deletions

View File

@@ -0,0 +1,28 @@
import { NextResponse } from 'next/server'
import { readFile } from 'fs/promises'
import { join } from 'path'
export async function GET() {
try {
// Имитация полученных данных в формате json (данные в data/detectors.json)
const filePath = join(process.cwd(), 'frontend', 'data', 'detectors.json')
const fileContent = await readFile(filePath, 'utf8')
const allData = JSON.parse(fileContent)
return NextResponse.json({
success: true,
data: allData,
objectsCount: Object.keys(allData.objects || {}).length,
detectorsCount: Object.keys(allData.detectors || {}).length
})
} catch (error) {
console.error('Error fetching detectors data:', error)
return NextResponse.json(
{
success: false,
error: 'Failed to fetch detectors data'
},
{ status: 500 }
)
}
}