First Commit Test
This commit is contained in:
16
server/middleware/0.prisma.ts
Normal file
16
server/middleware/0.prisma.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
let prisma: PrismaClient
|
||||
|
||||
declare module 'h3' {
|
||||
interface H3EventContext {
|
||||
prisma: PrismaClient
|
||||
}
|
||||
}
|
||||
|
||||
export default eventHandler((event) => {
|
||||
if (!prisma) {
|
||||
prisma = new PrismaClient()
|
||||
}
|
||||
event.context.prisma = prisma
|
||||
})
|
||||
Reference in New Issue
Block a user