module Orion::DSL::RequestMethods
Overview
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
.
Defined in:
orion/dsl/request_methods.crConstant Summary
-
METHODS =
["GET", "HEAD", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"] of ::String
Macro 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.
-
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.
-
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
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