Documentation ¶
Index ¶
- func CtxValue[T any](ctx *Context, key any) (ret T, ok bool)
- func DecodeForm(r *http.Request, ptr any) error
- func RegisterApi[InType, OutType any](api string, handler func(*Context, *InType) (*OutType, error), ...)
- func RegisterRawApi(api string, handler HandlerFunc, middlewares ...HandlerFunc)
- func Serve(wwwdir string, port int)
- type Context
- type HandlerFunc
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterApi ¶
func RegisterApi[InType, OutType any](api string, handler func(*Context, *InType) (*OutType, error), middlewares ...HandlerFunc)
func RegisterRawApi ¶
func RegisterRawApi(api string, handler HandlerFunc, middlewares ...HandlerFunc)
Types ¶
type Context ¶
type Context struct { RawRequest *http.Request RawResponse http.ResponseWriter // contains filtered or unexported fields }
type HandlerFunc ¶
type HandlerFunc func(*Context)
func MakeAPIHandler ¶
func MakeAPIHandler[InType, OutType any](handler func(*Context, *InType) (*OutType, error)) HandlerFunc
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) RegisterApi ¶
func (s *Server) RegisterApi(api string, handler HandlerFunc, middlewares ...HandlerFunc)
Click to show internal directories.
Click to hide internal directories.