We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4a6f85f commit de150edCopy full SHA for de150ed
service/src/main.ts
@@ -7,13 +7,19 @@ import { join } from 'path'
7
import { AppModule } from './app.module'
8
import * as cookieParser from 'cookie-parser'
9
import * as passport from 'passport'
10
+import { ShutdownService } from '~/shutdown.service'
11
+import * as process from 'process'
12
13
declare const module: any
14
;(async (): Promise<void> => {
15
const app = await NestFactory.create<NestExpressApplication>(AppModule, {
16
cors: true,
17
})
- app.use((_, res: Response, next: () => void) => {
18
+ app.get(ShutdownService).subscribeToShutdown(async () => {
19
+ await app.close()
20
+ process.exit(0)
21
+ })
22
+ app.use((_: any, res: Response, next: () => void) => {
23
res.removeHeader('x-powered-by')
24
next()
25
0 commit comments