@nest-extended/decorators
v0.0.2-beta-9
Published
This package provides useful decorators for NestJS applications.
Readme
@nest-extended/decorators
This package provides useful decorators for NestJS applications.
Key Features
@User(): Retrieves the current user from the request (integrates withnestjs-clsor request object).@Public(): Marks a route as public (useful for authentication guards).@ModifyBody(): Allows modification of the request body before validation (e.g., settingcreatedBy).
Installation
npm install @nest-extended/decoratorsUsage
import { User, Public, ModifyBody, setCreatedBy } from '@nest-extended/decorators';
import { Controller, Get, Post } from '@nestjs/common';
@Controller('cats')
export class CatsController {
@Public()
@Get()
findAll() { ... }
@Post()
create(@ModifyBody(setCreatedBy()) body: CreateDto) { ... }
@Get('profile')
getProfile(@User() user: any) { ... }
}