init API Route

This commit is contained in:
headlesdev 2025-05-17 15:32:40 +02:00
parent 45e817672c
commit eb72e07d7f

View File

@ -0,0 +1,18 @@
import { NextResponse } from "next/server";
import prisma from "@/app/prisma";
export async function GET() {
try {
const user = await prisma.user.findMany();
if (user.length < 1) {
return NextResponse.json({ message: "No users found" }, { status: 200 });
}
return NextResponse.json({ message: "Users found" }, { status: 200 });
} catch (error: any) {
return NextResponse.json({ error: "Internal Server Error" }, { status: 500 });
}
}