Return to v2.1 docs


Configuration Routing struct mapper

Scopes any the controllers for any routes configured within this block to a subfolder (package) and also adds the package name to the URL.

Name Type Required Default Description
name string Yes Name to prepend to child route names.
package string No [runtime expression] Subfolder (package) to reference for controllers. This defaults to the value provided for name.
path string No [runtime expression] Subfolder path to add to the URL.
// Route name: apiV2Products
// Example URL: /api/v2/products/1234
// Controller: api.v2.Products
// Route name: apiV1Users
// Example URL: /api/v1/users
// Controller: api.v1.Users
.get(name="users", to="users##index")
.namespace(name="foo", package="foos", path="foose")
// Route name: fooBars
// Example URL: /foose/bars
// Controller: foos.Bars
.post(name="bars", to="bars##create")

Related Functions