Page Contents

Home > @loopback/openapi-v3 > operation

operation() function

Expose a Controller method as a REST API operation.

Signature:

export declare function operation(verb: string, path: string, spec?: OperationObject): MethodDecorator;

Parameters

Parameter Type Description
verb string HTTP verb, e.g. GET or POST.
path string The URL path of this operation, e.g. /product/{id}
spec OperationObject (Optional) The OpenAPI specification describing parameters and responses of this operation.

Returns:

MethodDecorator