What is the purpose of the @Get() decorator in NestJS?
@Get()
Handles PUT requests
Handles GET requests
Handles DELETE requests
Handles POST requests
What is the advantage of using built-in HTTP exception filters in NestJS?
They are only applicable for database-related exceptions.
They provide a streamlined way to handle common HTTP errors with predefined responses.
They are primarily used for handling authentication and authorization errors.
They allow you to bypass the need for exception handling altogether.
Which decorator allows you to access route parameters in NestJS?
@Body()
@Req()
@Query()
@Param()
How does Dependency Injection work in NestJS?
Dependency Injection is not supported in NestJS.
Dependencies are manually created and passed around.
Dependencies are fetched from a global configuration file.
NestJS automatically resolves and injects dependencies based on constructor parameters.
What is the primary purpose of using Interceptors in NestJS?
To handle database queries.
To create reusable UI components.
To define routes for API endpoints.
To intercept and modify incoming requests or outgoing responses.
How do you access query parameters in a NestJS controller method?
Using @Headers()
@Headers()
Using @Query()
Using @Body()
Using @Param()
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.
What are the building blocks of a NestJS application called?
Controllers
Modules
Components
Services
What is the role of the next() function in NestJS middleware?
next()
To send a response back to the client.
To log information about the request.
To terminate the request-response cycle.
To pass control to the next middleware in the stack or the route handler.
Which component in NestJS is responsible for handling incoming HTTP requests and routing them to the appropriate handlers?
Module
Provider
Middleware
Controller