Documentation ΒΆ
Index ΒΆ
- func BadRequestResponse(w http.ResponseWriter, r *http.Request, err error)
- func ErrorResponse(w http.ResponseWriter, status int, message interface{})
- func FailedValidationResponse(w http.ResponseWriter, r *http.Request, errors map[string]string)
- func JSON(w http.ResponseWriter, data map[string]interface{}) error
- func MethodNotAllowedResponse(w http.ResponseWriter, r *http.Request)
- func NotFoundResponse(w http.ResponseWriter, r *http.Request)
- func Send(w http.ResponseWriter, data string)
- func ServerErrorResponse(w http.ResponseWriter, r *http.Request, err error)
- func URLParam(req *http.Request, key string, fallback string) string
- type IApp
- type Level
- type Logger
- func (l *Logger) Debug(message string, properties map[string]string)
- func (l *Logger) Error(err error, properties map[string]string)
- func (l *Logger) Fatal(err string, properties map[string]string)
- func (l *Logger) Info(message string, properties map[string]string)
- func (l *Logger) Warn(message string, properties map[string]string)
- func (l *Logger) Write(message []byte) (n int, err error)
- type Route
- type Router
- type Routes
- type Server
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func BadRequestResponse ΒΆ
func BadRequestResponse(w http.ResponseWriter, r *http.Request, err error)
BadRequestResponse writes a bad request response
func ErrorResponse ΒΆ
func ErrorResponse(w http.ResponseWriter, status int, message interface{})
ErrorResponse writes an error message back to the requester
func FailedValidationResponse ΒΆ
FailedValidationResponse writes a failed validation response
func JSON ΒΆ
func JSON(w http.ResponseWriter, data map[string]interface{}) error
JSON to http response writer
func MethodNotAllowedResponse ΒΆ
func MethodNotAllowedResponse(w http.ResponseWriter, r *http.Request)
MethodNotAllowedResponse writes a method not allowed response
func NotFoundResponse ΒΆ
func NotFoundResponse(w http.ResponseWriter, r *http.Request)
NotFoundResponse writes a resource not found response
func Send ΒΆ
func Send(w http.ResponseWriter, data string)
func ServerErrorResponse ΒΆ
func ServerErrorResponse(w http.ResponseWriter, r *http.Request, err error)
ServerErrorResponse writes an internal server error response
Types ΒΆ
type IApp ΒΆ
type IApp interface { Route(method string, path string, handler http.HandlerFunc) Run(host string, port int) Use(middleware ...middleware.AppMiddleware) WrapRoute(handler http.HandlerFunc, middleware ...middleware.AppMiddleware) http.HandlerFunc }
type Logger ΒΆ
Logger model
type Route ΒΆ
type Route struct { Path *regexp.Regexp Method string HandlerFunc http.HandlerFunc }
type Router ΒΆ
type Router struct { Routes Routes GlobalMiddleware []middleware.AppMiddleware NotFound http.HandlerFunc MethodNotAllowed http.HandlerFunc }
Source Files ΒΆ
Click to show internal directories.
Click to hide internal directories.