Skip to content

question: how to set optional @Param ? #335

Closed
@StephenBeg

Description

@StephenBeg

Hi,

How i can set optionnal parameter with @param ?

Documentation say :
@Param(name: string, options?: ParamOptions)

But in fact, @param have only one argument :
export function Param(name: string): Function

@Get('/dev/:test?')
@OnUndefined(200)
public async devRoute(@Param('test') test: string): Promise<void> {
    // Some stuff
    console.log('test : ', test);
}

Maybe i miss something ?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionQuestions about the usage of the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions