class
Radbas::ApplicationBuilder
- Radbas::ApplicationBuilder
- Radbas::RouteCollector
- Reference
- Object
Overview
Collects global middleware and routes, then builds the Application.
Global middleware runs for every request, in the order it was added, before the router.
Defined in:
radbas-framework/application_builder.crConstructors
Instance Method Summary
-
#add_error_handler_middleware(error_handler : ErrorHandlerLike = CommonErrorHandler.new(@logger)) : ErrorHandlerMiddleware
Adds the
ErrorHandlerMiddleware, unless already added. -
#add_request_logger_middleware(logger : ::Log = @logger) : RequestLoggerMiddleware
Adds the
RequestLoggerMiddleware, unless already added. -
#add_routing_middleware : RoutingMiddleware
Adds the
RoutingMiddleware, unless already added. - #build : Application
Instance methods inherited from class Radbas::RouteCollector
delete(path : String, action : ActionLike, name : String | Nil = nil) : self
delete,
get(path : String, action : ActionLike, name : String | Nil = nil) : self
get,
group(path : String = "", & : RouteCollector -> ) : self
group,
head(path : String, action : ActionLike, name : String | Nil = nil) : self
head,
map(method : String, path : String, action : ActionLike, name : String | Nil = nil) : self
map,
options(path : String, action : ActionLike, name : String | Nil = nil) : self
options,
patch(path : String, action : ActionLike, name : String | Nil = nil) : self
patch,
post(path : String, action : ActionLike, name : String | Nil = nil) : self
post,
put(path : String, action : ActionLike, name : String | Nil = nil) : self
put,
sse(path : String, handler : StreamHandlerLike, name : String | Nil = nil) : self
sse,
ws(path : String, handler : SocketHandlerLike, name : String | Nil = nil) : self
ws
Constructor methods inherited from class Radbas::RouteCollector
new(router : Routing::Router(Action), middleware : Array(MiddlewareLike), route_path : String)
new
Instance methods inherited from module Radbas::MiddlewareCollector
add(http_handler : HTTP::Handler) : selfadd(middleware : MiddlewareLike) : self add
Constructor Detail
Instance Method Detail
def add_error_handler_middleware(error_handler : ErrorHandlerLike = CommonErrorHandler.new(@logger)) : ErrorHandlerMiddleware
#
Adds the ErrorHandlerMiddleware, unless already added.
If not added explicitly, #build adds it right after the request logger, so it catches errors of all other middleware.
def add_request_logger_middleware(logger : ::Log = @logger) : RequestLoggerMiddleware
#
Adds the RequestLoggerMiddleware, unless already added.
def add_routing_middleware : RoutingMiddleware
#
Adds the RoutingMiddleware, unless already added. Middleware added before it can't see the matched route.
If not added explicitly, #build adds it after all other middleware.