How does Dependency Injection work in NestJS?
Dependency Injection is not supported in NestJS.
NestJS automatically resolves and injects dependencies based on constructor parameters.
Dependencies are fetched from a global configuration file.
Dependencies are manually created and passed around.
When using an Interceptor to modify the response, what is the best way to ensure type safety?
Type casting within the Interceptor.
Disabling type checks within the Interceptor.
Using generics with the NestInterceptor interface.
NestInterceptor
Type checking is not necessary within Interceptors.
Inside an Interceptor's intercept method, what object allows you to modify the response?
intercept
ctx.request
interceptor.transform()
next.handle()
ctx.response
Which of the following best describes NestJS?
A server-side framework for building efficient and scalable applications
A cloud computing platform for deploying and scaling applications
A database management system for storing application data
A front-end framework for building user interfaces
What interface must a class implement to act as an Interceptor in NestJS?
ResponseInterceptor
RequestInterceptor
HttpInterceptor
Which decorator is associated with removing resources in RESTful APIs?
@Post()
@Delete()
@Get()
@Put()
How do you apply an exception filter globally in a NestJS application?
By decorating the controller class with the filter.
By manually invoking the filter within each controller method.
By adding the filter class to the providers array of a module.
providers
By using the useGlobalFilters() method in the app.module.ts file.
useGlobalFilters()
app.module.ts
Which decorator is used to apply middleware to a specific route in NestJS?
@UseMiddleware()
@Middleware()
@ApplyMiddleware()
@Route()
Which decorator allows you to access route parameters in NestJS?
@Body()
@Param()
@Query()
@Req()
What is the role of the 'HttpException' class in NestJS exception handling?
It's a module for configuring global exception handling.
It's a decorator for marking methods that handle HTTP exceptions.
It's a base class for creating custom exceptions with HTTP status codes.
It's an interface for defining the structure of exception objects.