module

Orion::DSL::Root

The root macro is a shortcut to making a get "/" at the root of you application or at the root of a scope.

Macros

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
Source
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).

router MyRouter do
  root to: "#action"
end
Source
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
Source
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
Source