Orion::DSL::RequestMethods
Request method macros are shorthard ways of constraining a request to a single
request method. You can read more about the options available to each of these
macros in the Orion::DSL::Match.
Constants
Macros
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#connect"
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
match "/path", controller: MyController, action: connect
Defines a CONNECT route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#delete"
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
match "/path", controller: MyController, action: delete
Defines a DELETE route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#get"
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
match "/path", controller: MyController, action: get
Defines a GET route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#head"
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
match "/path", controller: MyController, action: head
Defines a HEAD route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#options"
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
match "/path", controller: MyController, action: options
Defines a OPTIONS route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#patch"
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
match "/path", controller: MyController, action: patch
Defines a PATCH route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#post"
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
match "/path", controller: MyController, action: post
Defines a POST route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#put"
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
match "/path", controller: MyController, action: put
Defines a PUT route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
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
match "/path", Callable
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 "#action".
class MyController < BaseController
def match
# ... do something
end
end
match "/path", to: "My#trace"
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
match "/path", controller: MyController, action: trace
Defines a TRACE route with a block.
You can pass a block. Each block will be evaluated as a controller method and have access to all controller helper methods.
match "/path" do
# ... do something
end