Skip to content

Method

function Method(method: string, path?: string): Function

Registers the decorated method as a handler for an arbitrary HTTP method.

Use this when none of the named decorators (@Get, @Post, etc.) fit. Only methods in the framework’s supported set are accepted (same list as the named decorators).

method string · The HTTP method string (e.g. "OPTIONS", "HEAD").

path? string · The URL path pattern to match.

returns Function

Learn: Controller classes

Last updated: