module ActionController::Route::Builder

Overview

helpers for defining routes with strong parameters

Direct including types

Defined in:

action-controller/router/builder.cr

Constant Summary

DEFAULT_PARSER = ["application/json"]

by default applications expect to receive JSON

DEFAULT_RESPONDER = ["application/json"]

by default applications respond with JSON

Macro Summary

Macro Detail

macro add_parser(content_type, &block) #

add code that can be used to deserialise request bodies of the content-type provided

add_parser("application/yaml") do |klass, body_io, request|
  request_charset = ActionController::Support.charset(request.headers)
  body_io.set_encoding(request_charset) if request_charset
  klass.from_yaml(body_io)
end

[View source]
macro add_responder(content_type, &block) #

add a new responder for the content-type provided, this will be called to render responses

add_responder("application/yaml") { |io, result| result.to_yaml(io) }

[View source]
macro default_parser(content_type) #

specify the default content-type of request bodies, if the user doesn't specify one


[View source]
macro default_responder(content_type) #

specify the responder content-type to use if the user doesn't request one


[View source]