Put in order · NestJS course · Module 1: NestJS Basics
Environment Configuration in NestJS
Arrange the steps for configuring environment variables from first to last:
Items to put in order
- Using configService.get('KEY') in services
- Creating the .env file with keys and values
- Registering ConfigModule.forRoot() in the root module
- Injecting ConfigService through the constructor
Show the answer
Correct order:
- Creating the .env file with keys and values
- Registering ConfigModule.forRoot() in the root module
- Injecting ConfigService through the constructor
- Using configService.get('KEY') in services