You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You need to create a PrismaService and a PrismaModule
Prisma Module
import{Module}from'@nestjs/common';import{PrismaService}from'./prisma.service';/** * Any module that imports the PrismaModule will have access to PrismaService */
@Module({providers: [PrismaService],exports: [PrismaService],})exportclassPrismaModule{}
Think about add it in your app.module.ts
Prisma Service
Here is a simple example of a PrismaService
import{INestApplication,Injectable,OnModuleInit}from'@nestjs/common';import{PrismaClient}from'@prisma/client';
@Injectable()exportclassPrismaServiceextendsPrismaClientimplementsOnModuleInit{asynconModuleInit(){awaitthis.$connect();}/** * Ensure application shuts down gracefully. */asyncenableShutdownHooks(app: INestApplication){this.$on('beforeExit',async()=>{awaitapp.close();});}}