Files
9router/src/app/api/headroom/status/route.js
T

18 lines
641 B
JavaScript
Raw Normal View History

import { NextResponse } from "next/server";
import { getSettings } from "@/lib/localDb";
import { getHeadroomStatus } from "@/lib/headroom/detect";
import { getManagedPid } from "@/lib/headroom/process";
export const dynamic = "force-dynamic";
export async function GET() {
try {
const settings = await getSettings();
const url = settings.headroomUrl || "http://localhost:8787";
const status = await getHeadroomStatus(url);
const managedPid = getManagedPid();
return NextResponse.json({ ...status, url, managedPid });
} catch (error) {
return NextResponse.json({ error: error.message }, { status: 500 });
}
}