Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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 by www.prisma.io #
 
PREVIOUS NEXT
Tagged: #nestjs #prisma
ADD COMMENT
Topic
Name
8+9 =