nestjs prisma
import { Injectable, OnModuleInit, OnModuleDestroy } from '@nestjs/common'; 2 import { PrismaClient } from '@prisma/client'; 3 4 @Injectable() 5 export class PrismaService extends PrismaClient 6 implements OnModuleInit, OnModuleDestroy { 7 async onModuleInit() { 8 await this.$connect(); 9 } 10 11 async onModuleDestroy() { 12 await this.$disconnect(); 13 } 14 }
Source: www.prisma.io