An ES2016 decorator is an expression which returns a function and can take a target, name and property descriptor as arguments. You apply it by prefixing the decorator with an @ character and placing this at the very top of what you are trying to decorate. Decorators can be defined for either a class, a method or a property.
Param decorators
Nest provides a set of useful param decorators that you can use together with the HTTP route handlers.
| @Request(), @Req() | req |
| @Response(), @Res() | res |
| @Next() | next |
| @Session | req.session |
| @Param(param?: string) | req.params / req.params[param] |
| @Body(param?:string) | req.body / req.body[param] |
| @Query(param?:string) | req.query / req.query[param] |
| @Headers(param?:string) | req.headers / req.headers[param] |
| @Ip() | req.ip |
| @HostParam() | req.hosts |
'Web > NestJS' 카테고리의 다른 글
| Module (0) | 2024.02.22 |
|---|---|
| Provider (0) | 2024.02.20 |
| Controllers (0) | 2024.02.15 |
댓글