Skip to content

Commit 34bf546

Browse files
committed
fix: new nodejs version
1 parent 822b1c9 commit 34bf546

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

src/cluster.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import cluster from "node:cluster";
22
import os from "node:os";
33

4-
import process from "node:process";
4+
import { HelperService } from "@common/helpers";
55
import { Logger } from "@nestjs/common";
66
import { isUndefined } from "helper-fns";
7-
import { HelperService } from "@common/helpers";
7+
import process from "node:process";
88

99
export class Cluster {
1010
private static readonly loggerService = new Logger(Cluster.name);

src/main.ts

+17-10
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,28 @@ import { LoggerErrorInterceptor } from "nestjs-pino";
1717
import { AppModule } from "./modules/app.module";
1818
import { SocketIOAdapter } from "./socket-io.adapter";
1919

20-
declare const module: { hot: { accept: () => void, dispose: (argument: () => Promise<void>) => void } };
20+
declare const module: {
21+
hot: { accept: () => void; dispose: (argument: () => Promise<void>) => void };
22+
};
2123

2224
const logger = new Logger("Bootstrap");
2325

2426
async function bootstrap() {
25-
const app = await NestFactory.create<NestExpressApplication>(AppModule, new ExpressAdapter(), {
26-
snapshot: true,
27-
});
27+
const app = await NestFactory.create<NestExpressApplication>(
28+
AppModule,
29+
new ExpressAdapter(),
30+
{
31+
snapshot: true,
32+
},
33+
);
2834

2935
const configService = app.get(ConfigService<Configs, true>);
3036

3137
// =========================================================
3238
// configure swagger
3339
// =========================================================
3440

35-
if (!HelperService.isProd())
36-
AppUtils.setupSwagger(app, configService);
41+
if (!HelperService.isProd()) AppUtils.setupSwagger(app, configService);
3742

3843
// ======================================================
3944
// security and middlewares
@@ -67,7 +72,9 @@ async function bootstrap() {
6772

6873
app.useGlobalPipes(new ValidationPipe(AppUtils.validationPipeOptions()));
6974

70-
app.useGlobalFilters(new I18nValidationExceptionFilter({ detailedErrors: false }));
75+
app.useGlobalFilters(
76+
new I18nValidationExceptionFilter({ detailedErrors: false }),
77+
);
7178

7279
app.useGlobalInterceptors(new LoggerErrorInterceptor());
7380

@@ -95,7 +102,8 @@ async function bootstrap() {
95102
module.hot.dispose(() => app.close());
96103
}
97104

98-
const port = process.env.PORT ?? configService.get("app.port", { infer: true })!;
105+
const port =
106+
process.env.PORT ?? configService.get("app.port", { infer: true })!;
99107

100108
await app.listen(port);
101109

@@ -120,7 +128,6 @@ async function bootstrap() {
120128

121129
try {
122130
(async () => await bootstrap())();
123-
}
124-
catch (error) {
131+
} catch (error) {
125132
logger.error(error);
126133
}

0 commit comments

Comments
 (0)