spacerr
Version:
This starter pack provides a comprehensive Next.js setup, built on top of `create-next-app`, and includes additional features. Developed by spacerrr.
16 lines (10 loc) • 378 B
text/typescript
import { PrismaClient } from "@prisma/client";
const prismaClientSingleton = () => {
return new PrismaClient();
};
declare const globalThis: {
prismaGlobal: ReturnType<typeof prismaClientSingleton>;
} & typeof global;
const db = globalThis.prismaGlobal ?? prismaClientSingleton();
export { db };
if (process.env.NODE_ENV !== "production") globalThis.prismaGlobal = db;