diff --git a/src/kemal/common_exception_handler.cr b/src/kemal/common_exception_handler.cr index 8893c4f..9a968a3 100644 --- a/src/kemal/common_exception_handler.cr +++ b/src/kemal/common_exception_handler.cr @@ -1,4 +1,5 @@ module Kemal + # Kemal::CommonExceptionHandler handles all the exceptions including 404, custom errors and 500. class CommonExceptionHandler < HTTP::Handler INSTANCE = new diff --git a/src/kemal/config.cr b/src/kemal/config.cr index 8c023d5..7f10e94 100644 --- a/src/kemal/config.cr +++ b/src/kemal/config.cr @@ -1,4 +1,9 @@ module Kemal + # Kemal::Config stores all the configuration options for a Kemal application. + # It's a singleton and you can access it like. + # + # Kemal.config + # class Config INSTANCE = Config.new HANDLERS = [] of HTTP::Handler diff --git a/src/kemal/context.cr b/src/kemal/context.cr index 69748fd..8d5aa85 100644 --- a/src/kemal/context.cr +++ b/src/kemal/context.cr @@ -1,8 +1,10 @@ -# Context is the environment which holds request/response specific -# information such as params, content_type e.g +# HTTP::Server::Context is the class which holds HTTP::Request and HTTP::Server::Response alongside with +# information such as request params, request/response content_type, session e.g +# +# Instances of this class are passed to an `HTTP::Server` handler. class HTTP::Server class Context - alias StoreTypes = Nil | String | Int32 | Float64 | Bool + alias StoreTypes = Nil | String | Int32 | Float64 | Bool getter store = {} of String => StoreTypes def params diff --git a/src/kemal/exceptions.cr b/src/kemal/exceptions.cr index 83c2753..c8ce340 100644 --- a/src/kemal/exceptions.cr +++ b/src/kemal/exceptions.cr @@ -1,3 +1,4 @@ +# Exceptions for 404 and custom errors are defined here. module Kemal::Exceptions class RouteNotFound < Exception def initialize(context)