stacker.news/api/models/index.js

15 lines
260 B
JavaScript
Raw Normal View History

2021-03-25 19:29:24 +00:00
import { PrismaClient } from '@prisma/client'
let prisma
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient()
} else {
if (!global.prisma) {
global.prisma = new PrismaClient()
}
prisma = global.prisma
}
export default prisma