@loopback/docs
Version:
Documentation for LoopBack 4
47 lines (29 loc) • 973 B
Markdown
lang: en
title: 'API docs: openapi-v3.api'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.openapi-v3.api.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/openapi-v3](./openapi-v3.md) > [api](./openapi-v3.api.md)
## api() function
Decorate the given Controller constructor with metadata describing the HTTP/REST API the Controller implements/provides.
`@api` can be applied to controller classes.
<b>Signature:</b>
```typescript
export declare function api(spec: ControllerSpec): ClassDecorator;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| spec | <code>ControllerSpec</code> | OpenAPI specification describing the endpoints handled by this controller |
<b>Returns:</b>
`ClassDecorator`
## Example
```ts
@api({basePath: '/my'})
class MyController {
// ...
}
```