Mount class

Mounts a Router instance at the specified path.

Use this annotation on controller methods that return a Router instance to mount that router at the specified path relative to the controller's base path. This is useful for creating nested routers or modular routing structures.

Example:

@Controller('/api')
class ApiController {
  final UserController _userController;

  ApiController(this._userController);

  @Mount('/users') // Mounts the user router at /api/users
  Router get userRouter => _userController.router;

  @Get('/status')
  Response getApiStatus(Request request) {
    return Response.ok(jsonEncode({'status': 'online'}));
  }
}

Constructors

Mount([String path = '/'])
Creates a Mount annotation with the specified path.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
path → String
The path at which to mount the router.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited