Services: Admin-Lehrer, Backend-Lehrer, Studio v2, Website, Klausur-Service, School-Service, Voice-Service, Geo-Service, BreakPilot Drive, Agent-Core Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
35 lines
900 B
TypeScript
35 lines
900 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
/**
|
|
* Proxy for /api/recordings base endpoint
|
|
*/
|
|
|
|
const BACKEND_URL = process.env.BACKEND_URL || 'http://localhost:8000'
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const url = `${BACKEND_URL}/api/recordings`
|
|
|
|
try {
|
|
const response = await fetch(url, {
|
|
method: 'GET',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
})
|
|
|
|
const data = await response.text()
|
|
return new NextResponse(data, {
|
|
status: response.status,
|
|
headers: {
|
|
'Content-Type': response.headers.get('content-type') || 'application/json',
|
|
},
|
|
})
|
|
} catch (error) {
|
|
console.error(`Failed to proxy GET ${url}:`, error)
|
|
return NextResponse.json(
|
|
{ error: 'Backend nicht erreichbar', details: error instanceof Error ? error.message : 'Unknown error' },
|
|
{ status: 502 }
|
|
)
|
|
}
|
|
}
|