What is the purpose of the 'ParseIntPipe' in NestJS?
To validate the data type of an input parameter.
To transform a numeric string into an integer.
To convert a string value to a Boolean.
To parse an object into a JSON string.
What is the role of a 'Guard' in the context of NestJS authentication?
Encrypting sensitive data
Storing user credentials
Defining API routes
Validating incoming requests and verifying user authentication
When would you create a custom Guard in NestJS instead of relying on built-in solutions?
When you need to perform standard JWT (JSON Web Token) authentication.
When you need to implement authorization logic tailored to your application's specific requirements, which might involve checking for custom permissions or conditions.
When you want to handle database migrations automatically.
When you need to send emails after a user signs up.
What is the role of the 'transform()' method within a custom Pipe in NestJS?
It contains the logic to transform the input data.
It specifies how the Pipe should handle errors.
It determines if the Pipe should be applied globally.
It defines the metadata associated with the Pipe.
What is the role of the @SetMetadata decorator in NestJS?
@SetMetadata
It validates the data type of a method parameter.
It attaches metadata to a class or method.
It defines a custom decorator factory.
It applies middleware to a specific route handler.
What is the purpose of a Model in Mongoose?
To interact with a specific collection in the database based on a defined schema
To create and manage database migrations
To handle user authentication and authorization
To define a database connection string
What is a key benefit of using event subscribers in NestJS?
Centralized management and organization of event listeners
Enhanced type safety when defining event listeners
Automatic retry mechanisms for failed event handlers
Improved performance for handling a large volume of events
Why is it generally advisable to have a balance of different testing types (unit, integration, E2E) in a NestJS project?
To reduce the need for manual testing efforts completely
To minimize the execution time of the entire test suite
To eliminate the possibility of introducing bugs during development entirely
To ensure comprehensive test coverage across different levels of the application
When designing a microservice using NestJS, what is a recommended practice for ensuring service discovery?
Relying on client-side load balancing
Hardcoding service addresses
Using a service registry (e.g., Consul, etcd)
Manually updating configuration files
Which testing type provides the most comprehensive coverage by simulating real user interactions with a running NestJS application?
Regression Testing
Integration Testing
Unit Testing
End-to-End (E2E) Testing