Documentation ¶
Index ¶
- func HandleGET[ResponseType any](fn func(map[string]string) (ResponseType, error)) http.HandlerFunc
- func HandlePOST[RequestType, ResponseType any](fn func(RequestType) (ResponseType, error)) http.HandlerFunc
- func HandlePUT[RequestType, ResponseType any](fn func(RequestType) (ResponseType, error)) http.HandlerFunc
- func WriteError(w http.ResponseWriter, err error)
- func WriteJSON(w http.ResponseWriter, content any)
- func WriteResponse(w http.ResponseWriter) func(any, error)
- func WriteSuccess(w http.ResponseWriter, response any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleGET ¶
HandleGET will parse the query string, and write a JSON response based on ResponseType
func HandlePOST ¶
func HandlePOST[RequestType, ResponseType any](fn func(RequestType) (ResponseType, error)) http.HandlerFunc
HandlePOST will parse the request body with RequestType, and write a JSON response based on ResponseType.
func HandlePUT ¶
func HandlePUT[RequestType, ResponseType any](fn func(RequestType) (ResponseType, error)) http.HandlerFunc
HandlePUT will parse the request body with RequestType, and write a JSON response based on ResponseType.
func WriteError ¶
func WriteError(w http.ResponseWriter, err error)
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, content any)
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter) func(any, error)
func WriteSuccess ¶
func WriteSuccess(w http.ResponseWriter, response any)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.