class
Amber::DSL::SchemaRouter
- Amber::DSL::SchemaRouter
- Reference
- Object
Overview
Extended Router that processes Schema annotations This is identical to the regular Router but adds Schema annotation processing
Defined in:
amber/dsl/schema_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
- connect(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
- delete(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
- get(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
- head(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
- namespace(scoped_namespace)
- options(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
- patch(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
- post(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
- put(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
- resources(resource, controller, only = nil, except = nil, constraints = {} of String => Amber::Router::ParamConstraint)
-
route(verb, resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
Enhanced route macro that works exactly like the regular router Schema annotation processing happens inside the controller
- trace(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, 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)
Declares a WebSocket endpoint at path.
Constructor Detail
Macro Detail
macro api_version(version, strategy = :url, prefix = "", header = "Api-Version", media_type = "application/vnd.amber")
#
API versioning macro
macro connect(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
macro delete(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
macro get(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
macro head(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
macro options(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
macro patch(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
macro post(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
macro put(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
macro resources(resource, controller, only = nil, except = nil, constraints = {} of String => Amber::Router::ParamConstraint)
#
macro route(verb, resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, route_name = nil)
#
Enhanced route macro that works exactly like the regular router Schema annotation processing happens inside the controller
macro trace(resource, controller, action, constraints = {} of String => Amber::Router::ParamConstraint, 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.
def websocket(path, app_socket)
#
Declares a WebSocket endpoint at path. Inside a #constraint block,
a handshake that fails the constraint gets a 404.