What is the role of Providers in NestJS?
To define the application's entry point.
To provide dependencies that can be injected into other components like controllers or services.
To render UI elements.
To handle data persistence.
Which decorator is used to apply middleware to a specific route in NestJS?
@ApplyMiddleware()
@Middleware()
@Route()
@UseMiddleware()
Which programming language forms the foundation of NestJS?
Java
Ruby
Python
JavaScript/TypeScript
How does Dependency Injection work in NestJS?
Dependency Injection is not supported in NestJS.
NestJS automatically resolves and injects dependencies based on constructor parameters.
Dependencies are fetched from a global configuration file.
Dependencies are manually created and passed around.
What is the purpose of the imports array in a NestJS module definition?
imports
To import external JavaScript libraries.
To define the routes handled by the module.
To import other modules, making their exported components available within the current module.
To include providers that are specific to the module.
Which of the following is NOT a valid HTTP method for defining routes in NestJS?
PATCH
DELETE
PUT
RENDER
Which decorator is used to define a basic GET route in NestJS?
@Path()
@Post()
@Get()
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 represents the next Interceptor in the chain or the route handler itself.
It handles errors thrown within the Interceptor.
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 specific service for a particular business logic.
It contains the application's main configuration and serves as the root module.
It defines a single controller for handling HTTP requests.
What is the purpose of the useFactory property in a FactoryProvider?
useFactory
FactoryProvider
To define a function that creates and returns an instance of the provider.
To specify the class that the factory function should return.
To configure the lifecycle hooks of the provider.
To provide a static value for the provider.