How to use kcd.Handler
The kcd.Handler
takes a function (which is your handler) and a default status code.
It returns a normal standard http.HandlerFunc
so you can use it with classic routers.
YourMagicHandler
is a handler of your application, this is where the magic happens!
Construct your handler
Function parameters accepted
context.Context
http.ResponseWriter
*http.Request
Your custom input struct as a pointer
Function return
Your custom output (could be either a pointer or non-pointer type)
error
Additional information
The minimal signature of your function looks like this:
The maximal signature of your function may look like this:
All inputs parameters can be omitted
The order of inputs parameters is not important
The Input (represented as
in *MyInput
) must be a pointerThe order of the return must be preserved with the error as the last parameter
Exception
You can use the standard http handler.
Last updated