@loopback/docs
Version:
Documentation for LoopBack 4
38 lines (23 loc) • 994 B
Markdown
lang: en
title: 'API docs: rest.restserver.api'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.rest.restserver.api.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/rest](./rest.md) > [RestServer](./rest.restserver.md) > [api](./rest.restserver.api.md)
## 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).
<b>Signature:</b>
```typescript
api(spec: OpenApiSpec): Binding;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| spec | <code>OpenApiSpec</code> | The OpenAPI specification, as an object. |
<b>Returns:</b>
`Binding`
Binding for the spec