Files
Compass/app/api/profiles/count/route.ts
MartinBraquet 1b5efb7207 Add user count
2025-07-31 00:26:06 +02:00

21 lines
543 B
TypeScript

import { prisma } from "@/lib/server/prisma";
import { NextResponse } from "next/server";
export async function GET() {
try {
// Get the total count of users from the database
const count = await prisma.user.count();
return NextResponse.json({ count });
} catch (error) {
console.error('Error fetching user count:', error);
return NextResponse.json(
{ error: "Failed to fetch user count" },
{ status: 500 }
);
}
}
// This ensures the route is not cached
export const dynamic = 'force-dynamic';