import { NextRequest, NextResponse } from "next/server"; import { errorResponse } from "../../../../lib/http"; import { getProject, listFiles, updateProject } from "../../../../lib/storage"; export const runtime = "nodejs"; export async function GET(_: Request, context: { params: Promise<{ id: string }> }) { try { const { id } = await context.params; const [project, files] = await Promise.all([getProject(id), listFiles(id)]); return NextResponse.json({ project, files }); } catch (error) { return errorResponse(error); } } export async function PUT(request: NextRequest, context: { params: Promise<{ id: string }> }) { try { const { id } = await context.params; return NextResponse.json({ project: await updateProject(id, await request.json()) }); } catch (error) { return errorResponse(error); } }