title: auto

des: auto
note:auto
This commit is contained in:
2023-11-09 17:37:21 +08:00
parent 56f6f4c71a
commit d0bd9e6bd6
5 changed files with 24 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
import prisma from "@/app/lib/prisma";
import { NextResponse } from "next/server";
import fs from "fs"
export async function GET({ 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"
}
})
}