@kazion/create-app
Version:
A cli tool to help you get started with graphql and rest api's with typescript
23 lines (18 loc) • 377 B
text/typescript
import { PrismaClient } from '@prisma/client'
let prisma: PrismaClient
declare global {
var _db_: PrismaClient
}
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient({
log: ['info', 'warn'],
})
} else {
if (!global._db_) {
global._db_ = new PrismaClient({
log: ['info', 'warn'],
})
}
prisma = global._db_
}
export { prisma }