Skip to content

RawPathParams

@tsed/platform-params

Usage

typescript
import { RawPathParams } from "@tsed/platform-params";

See /packages/platform/platform-params/src/types/decorators/pathParams.ts.

Overview

ts
function RawPathParams(expression: string): ParameterDecorator;
export function RawPathParams(options: Partial<ParamOptions>): ParameterDecorator;
export function RawPathParams(): ParameterDecorator;
  • expression (string): The path of the property to get.

Description

RawPathParams return the raw value from request.params object.

Any validation and transformation are performed on the value. Use pipes to validate and/or transform the value.

Example

typescript
@Controller('/')
class MyCtrl {
   @Get('/')
   get(@RawPathParams() params: string) {
      console.log('Entire params', params);
   }

   @Get('/')
   get(@RawPathParams('id') id: string) {
      console.log('ID', id);
   }
}

For more information on deserialization see converters page.

Released under the MIT License.