How are controllers related to modules in NestJS?
Controllers exist independently of modules.
Modules are defined within controllers.
Controllers are defined within modules, and their scope is limited to that module.
Controllers and modules are unrelated concepts in NestJS.
What is the order of execution for middleware applied at the controller and route level in NestJS?
Controller-level middleware executes first, followed by route-level middleware.
The order of execution is undefined.
The order can be controlled using a priority setting.
Route-level middleware executes first, followed by controller-level middleware.
What is the purpose of the @Get() decorator in NestJS?
@Get()
Handles PUT requests
Handles POST requests
Handles GET requests
Handles DELETE requests
Which decorator is used to define a controller in NestJS?
@Injectable()
@Controller()
@Component()
@Module()
How do you access the request body in a NestJS controller?
Accessing request.data
request.data
Through the context object
context
Using req.body
req.body
Using the @Body() decorator
@Body()
Can a Controller access a Service's methods in NestJS?
Yes, by injecting the Service into the Controller's constructor.
Yes, by using static methods of the Service.
No, Controllers and Services are completely isolated.
Only if the Controller and Service are defined in the same module.
How can you transform the data returned from a controller method using an Interceptor?
By calling a service method within the Interceptor.
By using RxJS operators on the Observable returned by next.handle().
next.handle()
By directly modifying the controller method's return value.
By modifying the ctx.body property.
ctx.body
What is the purpose of the return statement in a NestJS controller method?
return
To send the response to the client
To specify middleware for the route
To handle errors within the route
To define the route path
Which decorator allows you to access route parameters in NestJS?
@Req()
@Param()
@Query()
Which programming language forms the foundation of NestJS?
Ruby
Python
JavaScript/TypeScript
Java