Recall & Review
beginner
What is the purpose of the Root module (AppModule) in a NestJS application?
The Root module (AppModule) is the main module that NestJS uses to start the application. It organizes and connects all other modules, controllers, and providers.
Click to reveal answer
beginner
How do you define the Root module (AppModule) in NestJS?
You define the Root module by creating a class decorated with @Module() that lists imports, controllers, and providers. This class is usually named AppModule.Click to reveal answer
beginner
What are the main properties inside the @Module() decorator in AppModule?
The main properties are: imports (other modules to include), controllers (handle incoming requests), and providers (services or helpers).
Click to reveal answer
intermediate
Why is the Root module important for dependency injection in NestJS?
The Root module registers providers that can be injected into controllers and other providers throughout the app, enabling easy sharing of services.
Click to reveal answer
intermediate
What happens if you forget to include a controller or provider in the AppModule?
NestJS will not recognize or use that controller or provider, so your app might not respond to requests or services might not work as expected.
Click to reveal answer
What decorator is used to define the Root module in NestJS?
✗ Incorrect
The @Module() decorator is used to define modules, including the Root module (AppModule).
Which property inside @Module() lists the controllers for the module?
✗ Incorrect
The 'controllers' property lists all controllers that handle incoming requests in the module.
Where do you register services to be used across the app in the Root module?
✗ Incorrect
Services and helpers are registered in the 'providers' array to be injectable throughout the app.
What is the default name for the Root module class in a NestJS app?
✗ Incorrect
By convention, the Root module class is named AppModule.
If a module is not imported in AppModule, what happens?
✗ Incorrect
Modules must be imported in AppModule or other modules to be available; otherwise, their parts are not accessible.
Explain the role of the Root module (AppModule) in a NestJS application.
Think of it as the main organizer that connects all parts of your app.
You got /4 concepts.
Describe what happens if you forget to add a controller or provider to the AppModule.
Missing registration means NestJS doesn't know about that part.
You got /3 concepts.