Locals Decorator

Module
import { Locals } from "@tsed/common"
Source/packages/common/src/filters/decorators/locals.ts

Overview

function Locals(expression?: string | any): Function;
Param Type Description
expression string | any Optional. The path of the property to get.

Description

Locals return the value from response.locals object.

Example

@Controller('/')
class MyCtrl {
   @Get('/')
   get(@Locals() locals: any) {
      console.log('Entire locals', locals);
   }

   @Get('/')
   get(@Locals('user') user: any) {
      console.log('user', user);
   }
}

For more information on deserialization see converters page.