What is the purpose of the @Get() decorator in NestJS?
@Get()
Handles PUT requests
Handles GET requests
Handles DELETE requests
Handles POST requests
Which design pattern heavily influences the architecture of NestJS?
Dependency Injection
Factory
Singleton
Observer
Inside an Interceptor's intercept method, what object allows you to modify the response?
intercept
ctx.request
next.handle()
ctx.response
interceptor.transform()
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 terminate the request-response cycle.
To log information about the request.
What is a potential drawback of using singleton providers excessively in a large application?
Slower application startup time.
Increased memory usage due to persistent instances.
Difficulty in testing individual components.
All of the above.
Which decorator is used to define an Interceptor class in NestJS?
@Interceptor()
@Injectable()
@Module()
@Controller()
Which decorator is used to define a custom exception filter in NestJS?
@Catch()
What is the purpose of Providers in NestJS?
To handle routing and HTTP requests
To provide reusable logic and services that can be injected into other components
To define database models and interact with the database
To render the user interface and manage view templates
How can you create a custom provider in NestJS that provides a value instead of a class?
By using the @FactoryProvider() decorator.
@FactoryProvider()
By using the @ValueProvider() decorator.
@ValueProvider()
By using the @Injectable() decorator.
By using the @ClassProvider() decorator.
@ClassProvider()
Can a Controller access a Service's methods in NestJS?
Yes, by using static methods of the Service.
Only if the Controller and Service are defined in the same module.
Yes, by injecting the Service into the Controller's constructor.
No, Controllers and Services are completely isolated.