Configuration
api()
Signature
Section titled “Signature”api() — returns struct
Available in: mapper
Category: Routing
Description
Section titled “Description”Scope routes under an API path prefix. Shorthand for .group(path=“api”, name=“api”, …). Typically used in combination with version() to organize versioned API endpoints.
Parameters
Section titled “Parameters”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | no | api | URL path prefix for the API. Defaults to "api". |
name | string | no | api | Name prefix for route names. Defaults to "api". |
constraints | struct | no | — | Variable patterns to apply to all child routes. |
callback | any | no | — | A callback function to define nested routes within this API scope. |