module Orion::DSL::Root
Overview
The root macro is a shortcut to making a get "/"
at the root of you application
or at the root of a scope.
Defined in:
orion/dsl/root.crMacro Summary
-
root(callable, *, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Define a
GET /
route at the current path with a callable object. -
root(*, to, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Define a
GET /
route at the current path with a controller and action (short form). -
root(*, action, controller = CONTROLLER, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Define a
GET /
route at the current path with a controller and action (long form). -
root(*, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Define a
GET /
route at the current path with a callable object.
Macro Detail
macro root(callable, *, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
#
Define a GET /
route at the current path with a callable object.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
root Callable
end
Define a GET /
route at the current path with a controller and action (short form).
router MyRouter do
root to: "#action"
end
macro root(*, action, controller = CONTROLLER, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
#
Define a GET /
route at the current path with a controller and action (long form).
router MyRouter do
root controller: Controller action: action
end
macro root(*, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
#
Define a GET /
route at the current path with a callable object.
router MyRouter do
root do |context|
# ...
end
end