NestJS · Junior · Question 8 of 75
Why does Nest use decorators like @Controller() and @Injectable()?
- 1They are required by Node.js for all classes
- ✓Correct answer: They attach metadata to classes and methods, which Nest reads to build routes and wire dependencies
- 3They make the code run faster
Explanation
Nest uses TypeScript's decorator support (experimentalDecorators) and emitDecoratorMetadata, which records constructor parameter types for DI.