From 90692d7eff312ea433fc9d9d61b2ead1122b2709 Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Wed, 4 Oct 2023 17:55:56 +0800 Subject: [PATCH] feat Desc: - Penambahan api get foto profile --- src/app/api/profile/foto/[name]/route.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/app/api/profile/foto/[name]/route.ts diff --git a/src/app/api/profile/foto/[name]/route.ts b/src/app/api/profile/foto/[name]/route.ts new file mode 100644 index 00000000..9d4a9101 --- /dev/null +++ b/src/app/api/profile/foto/[name]/route.ts @@ -0,0 +1,11 @@ +import { NextRequest, NextResponse } from "next/server"; +import fs from 'fs' + +export async function GET(req: NextRequest, { params }: { params: { name: string } }) { + const fl = fs.readFileSync(`./public/img/${params.name}`) + return new NextResponse(fl, { + headers: { + "Content-Type": "image/png" + } + }) +} \ No newline at end of file