Files
AOS/src/app/api/aos/graphify-health/route.ts
T
Z User 25599a5516 feat: Graphify build worker endpoints + UI trigger
- POST /api/aos/instances/[id]/graph-build: trigger or get build command
- POST /api/aos/instances/[id]/graph-status: worker callback (ok/error)
- GET /api/aos/graphify-health: check if Graphify service is up
- Instance detail: 'Graph neu erstellen' button (visible when demo_active/active)
- Graceful degradation: if GRAPHIFY_URL not set, returns build command for external worker
2026-10-28 19:38:28 +00:00

33 lines
955 B
TypeScript

import { NextResponse } from 'next/server'
import { createGraphifyClientFromEnv } from '@/lib/graphify'
export const dynamic = 'force-dynamic'
// GET /api/aos/graphify-health
// Checks if the Graphify MCP HTTP service is configured and reachable.
// Used by the instance detail UI to show whether graphify is available.
export async function GET() {
const url = process.env.GRAPHIFY_URL
if (!url) {
return NextResponse.json({
configured: false,
ok: false,
message: 'Graphify not configured (GRAPHIFY_URL missing)',
})
}
const client = createGraphifyClientFromEnv()
if (!client) {
return NextResponse.json({ configured: true, ok: false, message: 'client init failed' })
}
const health = await client.health()
return NextResponse.json({
configured: true,
ok: health.ok,
url,
version: health.version,
message: health.ok ? 'Graphify service is up' : 'Graphify service unreachable',
})
}