import { NextRequest, NextResponse } from 'next/server'

const API = process.env.LEGAL_SERVICE_URL ?? 'http://localhost:3200'

export async function GET(req: NextRequest) {
  const search = req.nextUrl.searchParams.toString()
  const res = await fetch(`${API}/documents${search ? `?${search}` : ''}`, { cache: 'no-store' })
  return NextResponse.json(await res.json(), { status: res.status })
}
