Documentation ¶
Index ¶
- func Failure(w http.ResponseWriter, status int, err ErrorMessage)
- func FailureFromError(w http.ResponseWriter, status int, err error)
- func JSON(w http.ResponseWriter, code int, body interface{})
- func NotFoundFailure(w http.ResponseWriter, r *http.Request)
- type Controller
- type ErrorMessage
- type ErrorMessageInterface
- type ErrorResponse
- type HealthCheckHandler
- type HealthCheckResponse
- type Router
- func (r *Router) AddController(controller Controller)
- func (r *Router) AddHealthCheck(name string, handle HealthCheckHandler) error
- func (r *Router) AddPrefixRoute(prefix string, handler http.Handler) *mux.Route
- func (r *Router) AddPrefixRouteFunc(prefix string, handler http.HandlerFunc) *mux.Route
- func (r *Router) AddRoute(path string, handler http.Handler) *mux.Route
- func (r *Router) AddRouteFunc(path string, handler http.HandlerFunc) *mux.Route
- func (r *Router) EnableHealthCheck()
- func (r *Router) Use(middleware ...alice.Constructor)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FailureFromError ¶
func FailureFromError(w http.ResponseWriter, status int, err error)
FailureFromError write ErrorMessage from error
func NotFoundFailure ¶
func NotFoundFailure(w http.ResponseWriter, r *http.Request)
NotFoundFailure response
Types ¶
type Controller ¶
type Controller interface {
Mount(r *Router)
}
type ErrorMessage ¶
ErrorMessage struct
func (ErrorMessage) Error ¶
func (e ErrorMessage) Error() string
func (ErrorMessage) GetCode ¶
func (e ErrorMessage) GetCode() int
func (ErrorMessage) GetMessage ¶
func (e ErrorMessage) GetMessage() string
type ErrorMessageInterface ¶
ErrorMessageInterface interface
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorMessage `json:"error"`
}
type HealthCheckHandler ¶
HealthCheckHandler type
type HealthCheckResponse ¶
type HealthCheckResponse struct { Status bool `json:"status"` Services map[string]bool `json:"services"` }
HealthCheckResponse struct
type Router ¶
func (*Router) AddController ¶
func (r *Router) AddController(controller Controller)
func (*Router) AddHealthCheck ¶
func (r *Router) AddHealthCheck(name string, handle HealthCheckHandler) error
AddHealthCheck handler
func (*Router) AddPrefixRoute ¶
func (*Router) AddPrefixRouteFunc ¶
func (*Router) AddRouteFunc ¶
func (*Router) Use ¶
func (r *Router) Use(middleware ...alice.Constructor)
Click to show internal directories.
Click to hide internal directories.