🦅 NestJS Beginner

What are Decorators in NestJS?

Answer

Decorators are a TypeScript/JavaScript feature that NestJS uses extensively as a declarative, metadata-based programming model. NestJS decorators add metadata to classes and methods that the framework reads to configure behavior. Class decorators: @Module(), @Controller(), @Injectable(), @Guard(). Method decorators: @Get(), @Post(), @UseGuards(), @UseInterceptors(), @UsePipes(). Parameter decorators: @Body(), @Param(), @Query(), @Req(), @Res(). They enable a declarative style where behavior is expressed as annotations rather than imperative code, making controllers and classes highly readable.