import { readFile } from "fs/promises"; import path from "path"; import { NextResponse } from "next/server"; export const runtime = "nodejs"; const PDF_PATH = path.join( process.cwd(), "..", "..", "ingestion", "data", "raw", "duoc-thu-quoc-gia-viet-nam-2018.pdf" ); export async function GET() { try { const file = await readFile(PDF_PATH); return new NextResponse(file, { headers: { "Content-Type": "application/pdf", "Content-Disposition": "inline", }, }); } catch { return NextResponse.json( { error: "Không tìm thấy file PDF nguồn tại ingestion/data/raw/duoc-thu-quoc-gia-viet-nam-2018.pdf.", }, { status: 404 } ); } }