import { NextResponse } from "next/server";
import fs from "fs/promises";

export const POST = async (request: Request) => {
   try {
      console.log("[POST]")
      const formData = await request.formData()
      // const file = formData.get("file") as File;
      // const buffer = Buffer.from(await file.arrayBuffer());
      // await fs.writeFile("./test.png", buffer);
      return NextResponse.json({ success: true, message: "Berhasil mendapatkan banner", data: "file" }, { status: 200 });
   } catch (error) {
      console.error(error);
      return NextResponse.json({ success: false, message: "Gagal menambahkan banner, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });

   }

}