What is the role of CallHandler in the intercept method of an Interceptor?
CallHandler
intercept
It provides access to the dependency injection container.
It provides utility methods for transforming the request object.
It handles errors thrown within the Interceptor.
It represents the next Interceptor in the chain or the route handler itself.
How do you inject a provider from a different module in NestJS?
By importing the module containing the provider into the module where you need it.
By using the @Inject() decorator and specifying the provider's class name.
@Inject()
By creating a new instance of the provider using its constructor.
By accessing the global NestJS container.
Which of the following is NOT a valid HTTP method for defining routes in NestJS?
PUT
PATCH
RENDER
DELETE
Which decorator is used to define a controller in NestJS?
@Injectable()
@Component()
@Controller()
@Module()
What is the purpose of dependency injection in NestJS?
To manage database connections.
To define the application's routing logic.
To handle errors gracefully.
To provide a mechanism for creating and injecting dependencies into classes.
Which decorator is used to apply middleware to a specific route in NestJS?
@Route()
@ApplyMiddleware()
@UseMiddleware()
@Middleware()
How does Dependency Injection work in NestJS?
NestJS automatically resolves and injects dependencies based on constructor parameters.
Dependencies are manually created and passed around.
Dependency Injection is not supported in NestJS.
Dependencies are fetched from a global configuration file.
What is the role of the app.module.ts file in a NestJS application?
app.module.ts
It handles routing logic for different API endpoints.
It defines a single controller for handling HTTP requests.
It contains the application's main configuration and serves as the root module.
It defines a specific service for a particular business logic.
What is a common use case for middleware in NestJS?
Rendering HTML templates.
Generating database queries.
Implementing authentication and authorization logic.
Defining API endpoints.
Can you apply multiple middleware to a single route in NestJS?
Yes, by passing multiple middleware classes or functions to the @UseMiddleware() decorator.
No, only one middleware can be applied to a route.
Yes, but you need to create a separate middleware class that combines the functionality of others.
Yes, by using the @MultipleMiddleware() decorator.
@MultipleMiddleware()