diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 86628031ca2a10fe172fe824f69d1720c44b43ce..278b638f9d853fe8c1ff8cb67ea693775b49b99e 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -1,9 +1,10 @@ import { Module } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; import { AppController } from './app.controller'; import { AppService } from './app.service'; @Module({ - imports: [], + imports: [ConfigModule.forRoot()], controllers: [AppController], providers: [AppService], }) diff --git a/backend/src/main.ts b/backend/src/main.ts index 7780f480aca1d084333b64dfcc020e7e9f8a2cf0..7ec8d4b3d866f07bcd7d37cf38ec08df84363467 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -4,8 +4,9 @@ import { AppModule } from './app.module'; async function bootstrap(): Promise<void> { const app = await NestFactory.create(AppModule); - const configService = new ConfigService(); - const port = configService.get('PORT'); + const configService = app.get(ConfigService); + + const port = configService.get<number>('PORT'); console.log(`NestJS server is listening on: http://localhost:${port}`); await app.listen(port); }