What is the advantage of using built-in HTTP exception filters in NestJS?
They allow you to bypass the need for exception handling altogether.
They provide a streamlined way to handle common HTTP errors with predefined responses.
They are only applicable for database-related exceptions.
They are primarily used for handling authentication and authorization errors.
What is the primary function of middleware in NestJS?
To render dynamic views on the server.
To define API routes.
To handle database operations.
To intercept and modify incoming requests and outgoing responses.
What is the recommended way to access query parameters in a NestJS controller?
Through the context.request object
context.request
Using the @Query() decorator
@Query()
Using req.query
req.query
Accessing params.query
params.query
What is the primary programming language used for developing NestJS applications?
Java
C#
JavaScript
Python
What is the purpose of the useFactory property in a FactoryProvider?
useFactory
FactoryProvider
To provide a static value for the provider.
To define a function that creates and returns an instance of the provider.
To configure the lifecycle hooks of the provider.
To specify the class that the factory function should return.
What is the role of the 'HttpException' class in NestJS 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.
It's a module for configuring global exception handling.
When using @Inject(), what should you provide as the argument?
@Inject()
The string 'inject'.
The injection token of the dependency.
The class name of the dependency.
An instance of the dependency.
What is a key advantage of using NestJS over plain Express.js for building Node.js applications?
NestJS enforces a strict project structure and uses TypeScript for better code organization
NestJS is faster for handling HTTP requests
NestJS directly interacts with the database, eliminating the need for ORMs
NestJS is more lightweight and has fewer dependencies
Which of these features is NOT a primary advantage of using NestJS?
Leverages TypeScript for improved code structure and maintainability
Directly renders dynamic user interfaces in the browser
Encourages code organization through modules and providers
Provides a command-line interface (CLI) for easy project setup
When using an Interceptor to modify the response, what is the best way to ensure type safety?
Using generics with the NestInterceptor interface.
NestInterceptor
Type casting within the Interceptor.
Type checking is not necessary within Interceptors.
Disabling type checks within the Interceptor.