What is the difference between a provider and a service in NestJS?
Providers are classes that can be injected as dependencies, while a service is a specific type of provider with business logic.
Providers are decorated with @Injectable(), while services are decorated with @Service().
Providers are used for database operations, while services handle business logic.
Providers and services are essentially the same thing, with no real distinction.
Inside an Interceptor's intercept method, what object allows you to modify the response?
intercept
ctx.request
ctx.response
interceptor.transform()
next.handle()
What is the role of the 'main.ts' file in a NestJS project?
Defines the application's database schema and models
Creates and configures the NestJS application instance
Stores environment variables and configuration settings
Contains unit tests for the application's logic
Which decorator is associated with removing resources in RESTful APIs?
@Delete()
@Get()
@Post()
@Put()
How can you create a custom provider in NestJS that provides a value instead of a class?
By using the @ClassProvider() decorator.
@ClassProvider()
By using the @ValueProvider() decorator.
@ValueProvider()
By using the @Injectable() decorator.
@Injectable()
By using the @FactoryProvider() decorator.
@FactoryProvider()
Which decorator is used to mark a class as a provider in NestJS?
@Service()
@Controller()
@Module()
Which decorator is used to define a custom exception filter in NestJS?
@Catch()
After installing the NestJS CLI, what command is used to initiate a new NestJS project?
npm init nestjs-app
create-react-app my-nestjs-project
nest new project-name
nestjs create-app my-app
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 an interface for defining the structure of exception objects.
It's a module for configuring global exception handling.
It's a base class for creating custom exceptions with HTTP status codes.
When using @Inject(), what should you provide as the argument?
@Inject()
An instance of the dependency.
The class name of the dependency.
The string 'inject'.
The injection token of the dependency.