Files
supervisor-ui/app/api/supervisor/processes/[name]/start/route.ts

24 lines
730 B
TypeScript
Raw Normal View History

import { NextRequest, NextResponse } from 'next/server';
import { createSupervisorClient } from '@/lib/supervisor/client';
import { withLogging } from '@/lib/utils/api-logger';
interface RouteParams {
params: Promise<{ name: string }>;
}
export const POST = withLogging(async (request: NextRequest, { params }: RouteParams) => {
const { name } = await params;
const body = await request.json().catch(() => ({}));
const wait = body.wait !== undefined ? body.wait : true;
const client = createSupervisorClient();
const result = await client.startProcess(name, wait);
return NextResponse.json({
success: result,
message: `Process ${name} started`,
processName: name,
wait,
});
}, 'startProcess');