Which interface does a logging interceptor primarily implement in NestJS to intercept incoming requests and outgoing responses for logging purposes?
NestInterceptor
LoggingInterceptor
OnResponseInterceptor
OnRequestInterceptor
What is the primary purpose of a Guard in NestJS?
To render HTML templates on the server.
To control access to routes or resources based on certain conditions.
To define the structure of a request body.
To handle database interactions.
Which interface should a class implement to function as a Guard in NestJS?
IInjectable
IAuthorizationHandler
ICanActivate
IGuardProvider
How does NestJS facilitate database integration?
NestJS only supports relational databases and not NoSQL databases
NestJS prevents the use of external libraries like TypeORM or Mongoose
NestJS automatically configures database connections without any additional code
NestJS provides a modular structure and decorators to integrate various database solutions
When designing a microservice using NestJS, what is a recommended practice for ensuring service discovery?
Hardcoding service addresses
Relying on client-side load balancing
Manually updating configuration files
Using a service registry (e.g., Consul, etcd)
What is the difference between HttpException and a custom exception class in NestJS?
HttpException
There is no practical difference; both can be used interchangeably for error handling.
HttpException must be caught by custom exception filters, while custom exceptions are handled automatically.
HttpException is deprecated and should always be replaced with custom exception classes.
HttpException is used for generic HTTP errors, while custom exceptions represent specific business logic errors.
Which decorator type in NestJS is specifically designed to intercept and modify method arguments?
Property Decorator
Method Decorator
Parameter Decorator
Class Decorator
Why is it generally advisable to have a balance of different testing types (unit, integration, E2E) in a NestJS project?
To eliminate the possibility of introducing bugs during development entirely
To ensure comprehensive test coverage across different levels of the application
To reduce the need for manual testing efforts completely
To minimize the execution time of the entire test suite
How can you apply a Pipe globally to all route handlers in a NestJS application?
By registering the Pipe in the 'pipes' array within the @Controller() decorator.
By using the @Global() decorator on the Pipe class.
By providing the Pipe in the 'providers' array of the AppModule.
By using the 'useGlobalPipes()' method in the 'main.ts' file.
Which of the following is NOT a built-in Pipe provided by NestJS?
DefaultValuePipe
TransformationPipe
ParseIntPipe
ValidationPipe