mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-18 07:56:57 +00:00
init API Route
This commit is contained in:
parent
45e817672c
commit
eb72e07d7f
18
app/api/user/init/route.ts
Normal file
18
app/api/user/init/route.ts
Normal 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 });
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user