What is the purpose of the imports array in a NestJS module definition?
imports
To include providers that are specific to the module.
To import external JavaScript libraries.
To define the routes handled by the module.
To import other modules, making their exported components available within the current module.
Which of the following is NOT a valid scope for a provider in NestJS?
@RequestScoped()
@Singleton()
@Scoped()
@Transient()
What is the role of the next() function in NestJS middleware?
next()
To pass control to the next middleware in the stack or the route handler.
To send a response back to the client.
To log information about the request.
To terminate the request-response cycle.
Which interface does a custom exception filter in NestJS need to implement?
HttpException
Injectable
CanActivate
ExceptionFilter
Which decorator is used to define a controller in NestJS?
@Module()
@Component()
@Controller()
@Injectable()
What is NOT a benefit of using Dependency Injection in NestJS?
Enhanced code reusability.
Better maintainability of code.
Improved code testability.
Increased code coupling.
Which decorator allows you to access route parameters in NestJS?
@Body()
@Param()
@Query()
@Req()
Can you apply multiple middleware to a single route in NestJS?
No, only one middleware can be applied to a route.
Yes, by using the @MultipleMiddleware() decorator.
@MultipleMiddleware()
Yes, by passing multiple middleware classes or functions to the @UseMiddleware() decorator.
@UseMiddleware()
Yes, but you need to create a separate middleware class that combines the functionality of others.
In a typical NestJS project structure, which directory commonly houses the application's source code?
/public
/src
/node_modules
/dist
How does NestJS simplify unit testing of your application's components?
NestJS's modular structure and dependency injection make it easy to isolate and test individual components
NestJS has built-in tools that automatically generate unit tests
NestJS applications do not require unit tests due to their strict architecture
NestJS relies entirely on end-to-end testing, making unit tests unnecessary