module Orion::Router::Routes
Direct including types
Defined in:
orion/router/routes.crMacro Summary
-
connect(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a CONNECT route to a callable object.
-
connect(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a CONNECT route to a controller and action (short form).
-
connect(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a CONNECT route to a controller and action (long form).
-
connect(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a CONNECT route with a block.
-
delete(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a DELETE route to a callable object.
-
delete(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a DELETE route to a controller and action (short form).
-
delete(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a DELETE route to a controller and action (long form).
-
delete(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a DELETE route with a block.
-
get(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a GET route to a callable object.
-
get(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a GET route to a controller and action (short form).
-
get(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a GET route to a controller and action (long form).
-
get(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a GET route with a block.
-
head(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a HEAD route to a callable object.
-
head(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a HEAD route to a controller and action (short form).
-
head(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a HEAD route to a controller and action (long form).
-
head(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a HEAD route with a block.
-
match(path, callable, *, via = :all, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a {{ method.id }} route to a callable object.
-
match(path, *, to, via = :all, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a {{ method }} route to a controller and action (short form).
-
match(path, *, action, controller = CONTROLLER, via = :all, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a match route to a controller and action (long form).
-
match(path, *, via = :all, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a match route with a block.
-
mount(app, *, at = "/")
Mount an application at the specified path.
-
options(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a OPTIONS route to a callable object.
-
options(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a OPTIONS route to a controller and action (short form).
-
options(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a OPTIONS route to a controller and action (long form).
-
options(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a OPTIONS route with a block.
-
patch(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a PATCH route to a callable object.
-
patch(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a PATCH route to a controller and action (short form).
-
patch(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a PATCH route to a controller and action (long form).
-
patch(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a PATCH route with a block.
-
post(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a POST route to a callable object.
-
post(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a POST route to a controller and action (short form).
-
post(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a POST route to a controller and action (long form).
-
post(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a POST route with a block.
-
put(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a PUT route to a callable object.
-
put(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a PUT route to a controller and action (short form).
-
put(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a PUT route to a controller and action (long form).
-
put(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a PUT route with a block.
-
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. -
trace(path, callable, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a TRACE route to a callable object.
-
trace(path, *, to, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a TRACE route to a controller and action (short form).
-
trace(path, *, action, controller = CONTROLLER, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil)
Defines a TRACE route to a controller and action (long form).
-
trace(path, *, helper = nil, constraints = nil, format = nil, accept = nil, content_type = nil, type = nil, &block)
Defines a TRACE route with a block.
Macro Detail
Defines a CONNECT route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a CONNECT route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#connect"
end
Defines a CONNECT route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: connect
end
Defines a CONNECT route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
Defines a DELETE route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a DELETE route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#delete"
end
Defines a DELETE route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: delete
end
Defines a DELETE route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
Defines a GET route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a GET route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#get"
end
Defines a GET route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: get
end
Defines a GET route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
Defines a HEAD route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a HEAD route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#head"
end
Defines a HEAD route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: head
end
Defines a HEAD route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
Defines a {{ method.id }} route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a {{ method }} route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#match"
end
Defines a match route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: match
end
Defines a match route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
Defines a OPTIONS route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a OPTIONS route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#options"
end
Defines a OPTIONS route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: options
end
Defines a OPTIONS route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
Defines a PATCH route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a PATCH route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#patch"
end
Defines a PATCH route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: patch
end
Defines a PATCH route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
Defines a POST route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a POST route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#post"
end
Defines a POST route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: post
end
Defines a POST route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
Defines a PUT route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a PUT route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#put"
end
Defines a PUT route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: put
end
Defines a PUT route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end
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: "Controller#action"
end
Define a GET /
route at the current path with a controller and action (long form).
router MyRouter do
root controller: Controller action: action
end
Define a GET /
route at the current path with a callable object.
router MyRouter do
root do |context|
# ...
end
end
Defines a TRACE route to a callable object.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
module Callable
def call(cxt : HTTP::Server::Context)
# ... do something
end
end
router MyRouter do
match "/path", Callable
end
Defines a TRACE route to a controller and action (short form).
You can route to a controller and action by passing the to
argument in
the form of "Controller#action"
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", to: "MyController#trace"
end
Defines a TRACE route to a controller and action (long form).
You can route to a controller and action by passing the controller
and
action
arguments, if action is omitted it will default to match
.
class MyController
def new(@context : HTTP::Server::Context)
end
def match
# ... do something
end
end
router MyRouter do
match "/path", controller: MyController, action: trace
end
Defines a TRACE route with a block.
You can route to any object that responds to call
with an HTTP::Server::Context
,
this also works for any Proc(HTTP::Server::Context, _)
.
router MyRouter do
match "/path" do |context|
# ... do something
end
end