Recall & Review
beginner
What is a decorator in NestJS?
A decorator in NestJS is a special function that adds metadata or behavior to classes, methods, or properties. It helps organize code by marking parts with extra information NestJS uses to build the app.
Click to reveal answer
beginner
How does the @Controller() decorator work in NestJS?
The @Controller() decorator marks a class as a controller that handles incoming HTTP requests. It tells NestJS to group related routes inside this class.Click to reveal answer
beginner
What role do method decorators like @Get() or @Post() play in NestJS?
Method decorators like @Get() or @Post() define which HTTP method and route a class method should respond to. They connect URLs to specific functions.Click to reveal answer
intermediate
Why is decorator-based architecture helpful in NestJS?
It keeps code clean and easy to read by clearly showing what each part does. It also helps NestJS automatically build the app structure and handle requests without extra setup.
Click to reveal answer
intermediate
Can you explain how dependency injection uses decorators in NestJS?
Decorators like @Injectable() mark classes as services that NestJS can create and share. Then, constructor parameters typed with classes let NestJS automatically provide those services where needed.Click to reveal answer
What does the @Injectable() decorator do in NestJS?
✗ Incorrect
The @Injectable() decorator marks a class as a service that NestJS can inject into other classes.
Which decorator would you use to handle HTTP GET requests in NestJS?
✗ Incorrect
The @Get() decorator marks a method to handle HTTP GET requests.
What is the main purpose of decorators in NestJS architecture?
✗ Incorrect
Decorators add metadata and help organize the code structure in NestJS.
How does NestJS know which class is a controller?
✗ Incorrect
NestJS uses the @Controller() decorator to identify controller classes.
Which decorator helps NestJS inject dependencies automatically?
✗ Incorrect
The @Injectable() decorator marks classes for dependency injection.
Describe how decorators help organize a NestJS application.
Think about how NestJS uses special marks to know what each part does.
You got /4 concepts.
Explain the role of @Controller() and @Get() decorators in handling web requests.
Focus on how NestJS matches URLs to functions.
You got /4 concepts.