class
Amber::DSL::Router
- Amber::DSL::Router
- Reference
- Object
Overview
For now, always use the regular Router to maintain compatibility SchemaRouter can be used explicitly when needed
Defined in:
amber/dsl/router.crConstant Summary
-
RESOURCES =
[:get, :post, :put, :patch, :delete, :options, :head, :trace, :connect]
Constructors
Macro Summary
-
api_version(version, strategy = :url, prefix = "", header = "Api-Version", media_type = "application/vnd.amber")
API versioning macro - URL-based strategy uses namespace, header-based and media-type-based strategies use constraints.
- connect(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- delete(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- get(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- head(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- namespace(scoped_namespace)
- options(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- patch(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- post(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- put(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- resources(resource, controller, only = nil, except = nil, constraints = {} of String => Regex)
- route(verb, resource, controller, action, constraints = {} of String => Regex, route_name = nil)
- trace(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
Instance Method Summary
- #active_constraint : Amber::Router::Constraint | Nil
-
#constraint(constraint_object : Amber::Router::Constraint, &)
Scopes all routes defined in the block to require the given constraint.
- #router : Amber::Router::Router
- #scope : Amber::Router::Scope
- #valve : Symbol
- #websocket(path, app_socket)
Constructor Detail
Macro Detail
macro api_version(version, strategy = :url, prefix = "", header = "Api-Version", media_type = "application/vnd.amber")
#
API versioning macro - URL-based strategy uses namespace, header-based and media-type-based strategies use constraints.
macro connect(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
#
macro options(resource, controller, action, constraints = {} of String => Regex, route_name = nil)
#
macro resources(resource, controller, only = nil, except = nil, constraints = {} of String => Regex)
#
macro route(verb, resource, controller, action, constraints = {} of String => Regex, route_name = nil)
#
Instance Method Detail
def constraint(constraint_object : Amber::Router::Constraint, &)
#
Scopes all routes defined in the block to require the given constraint. The constraint object must implement Amber::Router::Constraint.