Page Contents

Home > @loopback/rest > RestServer > api

RestServer.api() method

Set the OpenAPI specification that defines the REST API schema for this server. All routes, parameter definitions and return types will be defined in this way.

Note that this will override any routes defined via decorators at the controller level (this function takes precedent).

Signature:

api(spec: OpenApiSpec): Binding;

Parameters

Parameter Type Description
spec OpenApiSpec The OpenAPI specification, as an object.

Returns:

Binding

Binding for the spec