Skip to content

Configuration

api()

api() — returns struct

Available in: mapper Category: Routing

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.

NameTypeRequiredDefaultDescription
pathstringnoapiURL path prefix for the API. Defaults to "api".
namestringnoapiName prefix for route names. Defaults to "api".
constraintsstructno—Variable patterns to apply to all child routes.
callbackanyno—A callback function to define nested routes within this API scope.