class Yeager::HTTPHandler

Overview

HTTP handler for Yeager::App which will use the provided routers (for each HTTP method there is a separate HTTPRouters instance) and handlers which are holding the handler functions for related paths for a given HTTP method.

on #call if there is a match with the provided path and the method this will invoke the provided handler with request, response which are in order HTTP::Request and HTTP::Server::Response

Handlers can be defined to handle non of the arguments or only the request or both of them.

If the requested method is not supported yet response NOT_IMPLEMENTED will be returned with status_code 501

If there is no match in the router for given path and the method then NOT_FOUND_TEXT will be send as body with status_code 404

This handler uses HTTP::Handler which can be used as a handler in an already existing HTTP::Server instance.

Included Modules

Defined in:

yeager/app.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(routers : HTTPRouters, handlers : HTTPHandlers) #

[View source]

Instance Method Detail

def call(ctx, index = 0) #

[View source]