Documentation ¶
Index ¶
- func BadRequest(slug string, err error, w http.ResponseWriter, r *http.Request)
- func Conflict(slug string, err error, w http.ResponseWriter, r *http.Request)
- func Forbidden(slug string, err error, w http.ResponseWriter, r *http.Request)
- func InternalServerError(slug string, err error, w http.ResponseWriter, r *http.Request)
- func NewHandler(params Params) http.Handler
- func NotFound(slug string, err error, w http.ResponseWriter, r *http.Request)
- func Unauthorized(slug string, err error, w http.ResponseWriter, r *http.Request)
- func UnprocessableEntity(slug string, err error, w http.ResponseWriter, r *http.Request)
- type AuthProvider
- type ErrorResponse
- type Formatter
- type MetricCollector
- type Middleware
- type Params
- type Route
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
func InternalServerError ¶
func NewHandler ¶
func Unauthorized ¶
func UnprocessableEntity ¶
Types ¶
type AuthProvider ¶
type ErrorResponse ¶
type ErrorResponse struct { Slug string `json:"slug"` Details string `json:"details"` // contains filtered or unexported fields }
func (ErrorResponse) Render ¶
func (e ErrorResponse) Render(w http.ResponseWriter, _ *http.Request) error
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
func (*Formatter) NewLogEntry ¶
func (l *Formatter) NewLogEntry(r *http.Request) middleware.LogEntry
type MetricCollector ¶
type MetricCollector interface {
IncRequestsCount(status, method, path string)
}
type Middleware ¶
func AuthMiddleware ¶
func AuthMiddleware(provider AuthProvider) Middleware
func CORSMiddleware ¶
func CORSMiddleware(allowedOrigins []string) Middleware
func LoggingMiddleware ¶
func LoggingMiddleware(logger service.Logger) Middleware
func MetricsMiddleware ¶
func MetricsMiddleware(metric MetricCollector) Middleware
type Params ¶
type Params struct { Middlewares []Middleware Routes []Route }
Click to show internal directories.
Click to hide internal directories.