From e7e873c75c5d26b0bd9e2233483eb9d3cd01eadd Mon Sep 17 00:00:00 2001 From: headlessdev Date: Thu, 17 Apr 2025 15:16:38 +0200 Subject: [PATCH] Implement endpoint to retrieve notifications --- app/api/notifications/get/route.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app/api/notifications/get/route.ts diff --git a/app/api/notifications/get/route.ts b/app/api/notifications/get/route.ts new file mode 100644 index 0000000..dff6e7f --- /dev/null +++ b/app/api/notifications/get/route.ts @@ -0,0 +1,16 @@ +import { NextResponse, NextRequest } from "next/server"; +import { prisma } from "@/lib/prisma"; + + +export async function POST(request: NextRequest) { + try { + + const notifications = await prisma.notification.findMany(); + + return NextResponse.json({ + notifications + }); + } catch (error: any) { + return NextResponse.json({ error: error.message }, { status: 500 }); + } +} \ No newline at end of file