File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { AppModule } from './app.module'
33
44async function bootstrap ( ) {
55 const app = await NestFactory . create ( AppModule )
6+ app . enableShutdownHooks ( )
67 await app . listen ( 3000 , ( ) => {
78 console . log ( `
89🚀 Server ready at: http://localhost:3000/graphql
Original file line number Diff line number Diff line change @@ -4,12 +4,7 @@ import { PrismaClient } from '@prisma/client'
44@Injectable ( )
55export class PrismaService extends PrismaClient implements OnModuleInit {
66 async onModuleInit ( ) {
7+ // Note: this is optional
78 await this . $connect ( )
89 }
9-
10- async enableShutdownHooks ( app : INestApplication ) {
11- this . $on ( 'beforeExit' , async ( ) => {
12- await app . close ( )
13- } )
14- }
1510}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { AppModule } from './app.module'
33
44async function bootstrap ( ) {
55 const app = await NestFactory . create ( AppModule )
6+ app . enableShutdownHooks ( )
67 await app . listen ( 3000 )
78}
89bootstrap ( )
Original file line number Diff line number Diff line change @@ -4,12 +4,7 @@ import { PrismaClient } from '@prisma/client'
44@Injectable ( )
55export class PrismaService extends PrismaClient implements OnModuleInit {
66 async onModuleInit ( ) {
7+ // Note: this is optional
78 await this . $connect ( )
89 }
9-
10- async enableShutdownHooks ( app : INestApplication ) {
11- this . $on ( 'beforeExit' , async ( ) => {
12- await app . close ( )
13- } )
14- }
1510}
You can’t perform that action at this time.
0 commit comments