What is the role of the catch() method in a custom HTTP exception filter?
catch()
It determines the appropriate HTTP status code for the exception.
It logs the exception to the console.
It re-throws the exception to be handled by a global exception filter.
It handles the exception and sends a customized error response.
What is the role of the @SetMetadata decorator in NestJS?
@SetMetadata
It defines a custom decorator factory.
It validates the data type of a method parameter.
It applies middleware to a specific route handler.
It attaches metadata to a class or method.
Which NestJS module is essential for creating TCP-based microservices?
@nestjs/common
@nestjs/platform-express
@nestjs/core
@nestjs/microservices
How can you apply a transformation interceptor to a specific method in a controller in NestJS?
By extending the BaseController class and applying the interceptor in the constructor
BaseController
By registering the interceptor globally in the app.module.ts file
app.module.ts
By using the @Transform() decorator above the controller class
@Transform()
By using the @UseInterceptors() decorator at the method level
@UseInterceptors()
In JWT authentication, what does JWT stand for?
Java Web Token
JavaScript Web Token
JSON Web Token
Just Write Tests
Which of the following is NOT a built-in Pipe provided by NestJS?
ParseIntPipe
TransformationPipe
DefaultValuePipe
ValidationPipe
What is the role of a Repository in TypeORM?
To provide methods for interacting with a specific entity
To manage database migrations
To define database tables
To handle user authentication
Which interface should a class implement to function as a Guard in NestJS?
IAuthorizationHandler
IInjectable
IGuardProvider
ICanActivate
In NestJS, which decorator is used to define a microservice?
@Controller()
@Module()
@Microservice()
@Injectable()
What is the typical role of a @SetMetadata decorator when working with custom Guards in NestJS?
It defines the structure of the response sent back to the client.
It directly handles user authentication logic.
It is used to inject dependencies into Guards.
It attaches custom metadata to route handlers, which can be accessed within the Guard to make authorization decisions.