title: auto

des: auto
note:auto
This commit is contained in:
2023-11-09 17:45:50 +08:00
parent d0f04e6ff1
commit 4c04137713
2 changed files with 1 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
import prisma from "@/app/lib/prisma";
import { NextRequest, NextResponse } from "next/server";
import fs from "fs";
export async function GET(
req: NextRequest,
{ params }: { params: { id: string } }
) {
const data = await prisma.prospektusInvestasi.findUnique({
where: { id: params.id },
select: {
url: true,
},
});
const file = fs.readFileSync(`./public/file/${data?.url}`);
return new NextResponse(file, {
headers: {
"Content-Type": "application/pdf",
},
});
}