class TodosController

Defined in:

controllers/todos_controller.cr

Constant Summary

AFTER = {} of Nil => Nil
AROUND = {} of Nil => Nil
BEFORE = {set_request_id => {nil, nil}, set_date_header => {nil, nil}, set_cors => {nil, nil}} of Nil => Nil
FORCE = {} of Nil => Nil
LOCAL_AFTER = {} of Nil => Nil

function => options

LOCAL_AROUND = {} of Nil => Nil

function => options

LOCAL_BEFORE = {} of Nil => Nil

function => options

LOCAL_FORCE = {} of Nil => Nil

function => options

LOCAL_RESCUE = {} of Nil => Nil

function => options

LOCAL_ROUTES = {delete_ => {"delete", "/", do Todo.query.each do |todo| todo.delete end end, false}, options_ => {"options", "/", do response.headers["Access-Control-Allow-Methods"] = "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS" end, false}, options__id => {"options", "/:id", do response.headers["Access-Control-Allow-Methods"] = "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS" end, false}} of Nil => Nil

function => options

LOCAL_SKIP = {} of Nil => Nil

function => options

NAMESPACE = ["/todos"]

default namespace based on class

RESCUE = {} of Nil => Nil
ROUTES = {delete_ => {"delete", "/", do Todo.query.each do |todo| todo.delete end end, false}, options_ => {"options", "/", do response.headers["Access-Control-Allow-Methods"] = "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS" end, false}, options__id => {"options", "/:id", do response.headers["Access-Control-Allow-Methods"] = "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS" end, false}, index => {"get", "/", nil, false}, create => {"post", "/", nil, false}, show => {"get", "/:id", nil, false}, update => {"patch", "/:id", nil, false}, destroy => {"delete", "/:id", nil, false}} of Nil => Nil
SKIP = {} of Nil => Nil

Class Method Summary

Instance Method Summary

Macro Summary

Instance methods inherited from class Application

set_cors set_cors, set_date_header set_date_header, set_request_id set_request_id

Class methods inherited from class Application

context(method : String, route : String, route_params : Hash(String, String) | Nil = nil, headers : Hash(String, String) | Nil = nil, body : String | Bytes | IO | Nil = nil, &) context

Class Method Detail

def self.__init_routes__(router) #

Routes call the functions generated above


def self.__route_list__ #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.base_route #

Helper for obtaining base route


def self.context(method : String, route : String, route_params : Hash(String, String) | Nil = nil, headers : Hash(String, String) | Nil = nil, body : String | Bytes | IO | Nil = nil, &) #

[View source]
def self.create(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.delete_(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Helper methods for performing redirect_to calls


def self.delete__todos_(context, head_request) #

Generate functions for each route


def self.delete__todos__id(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.destroy(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.get__todos_(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.get__todos__id(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.index(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.options_(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.options__id(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.options__todos_(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.options__todos__id(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.patch__todos__id(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.post__todos_(context, head_request) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.show(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


def self.update(hash_parts : Hash(String | Symbol, Nil | Bool | Int32 | Int64 | Float32 | Float64 | String | Symbol) | Nil = nil, **tuple_parts) #

Create draw_routes function

Create instance of controller class init with context, params and logger protocol checks (https etc) controller instance created begin exception helpers inline the around filters inline the before filters inline the action inline the after filters rescue exception handlers


Instance Method Detail

def base_route : String #

Helper for obtaining base route


def create #

POST /todos/


[View source]
def delete_ #

Create functions for named routes Skip the CRUD


def destroy #

DELETE /todos/:id


[View source]
def index #

GET /todos


[View source]
def options_ #

Skip the CRUD


def options__id #

Skip the CRUD


def show #

GET /todos/:id


[View source]
def todo : Todo #

[View source]
def update #

PATCH/PUT /todos/:id


[View source]

Macro Detail

macro __inherit_after_filters__ #

macro __inherit_around_filters__ #

macro __inherit_before_filters__ #

macro __inherit_force_filters__ #

macro __inherit_rescue_filters__ #

macro __inherit_routes_filters__ #

macro __inherit_skip_filters__ #