24 lines
710 B
TypeScript
24 lines
710 B
TypeScript
|
|
import { NextRequest, NextResponse } from 'next/server';
|
||
|
|
import { createSupervisorClient } from '@/lib/supervisor/client';
|
||
|
|
|
||
|
|
export const dynamic = 'force-dynamic';
|
||
|
|
|
||
|
|
interface RouteParams {
|
||
|
|
params: Promise<{ name: string }>;
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function GET(request: NextRequest, { params }: RouteParams) {
|
||
|
|
try {
|
||
|
|
const { name } = await params;
|
||
|
|
const client = createSupervisorClient();
|
||
|
|
const processInfo = await client.getProcessInfo(name);
|
||
|
|
return NextResponse.json(processInfo);
|
||
|
|
} catch (error: any) {
|
||
|
|
console.error('Supervisor process info error:', error);
|
||
|
|
return NextResponse.json(
|
||
|
|
{ error: error.message || 'Failed to fetch process info' },
|
||
|
|
{ status: 500 }
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|