Documentation ¶
Index ¶
- Constants
- func SendJSON(writer http.ResponseWriter, status int, p any)
- func SendJSONError(w http.ResponseWriter, status int, err error)
- func Serve(handler http.Handler, port int, logger loggerrific.Logger) error
- func SevereRateLimitMiddleware(next http.Handler) http.Handler
- func TimeoutMiddleware(next http.Handler) http.Handler
- type AudiobooksPodcastService
- type AudiobooksUpdateService
- type Handler
- type HandlerOption
- type Middlewares
- type Payload
Constants ¶
View Source
const ( ContentTypeHeader = "Content-Type" ContentTypeXML = "application/xml; charset=utf-8" ContentTypeJSON = "application/json; charset=utf-8" ContentTypeHTML = "text/html" )
Variables ¶
This section is empty.
Functions ¶
func SendJSONError ¶
func SendJSONError(w http.ResponseWriter, status int, err error)
Types ¶
type AudiobooksUpdateService ¶
type Handler ¶
type Handler struct { *mux.Router PodcastService AudiobooksPodcastService UpdateService AudiobooksUpdateService Log loggerrific.Logger // contains filtered or unexported fields }
func NewHandler ¶
func NewHandler(podcastService AudiobooksPodcastService, updateService AudiobooksUpdateService, logger loggerrific.Logger, opts ...HandlerOption) *Handler
type HandlerOption ¶
type HandlerOption func(h *Handler)
func WithMediaConfig ¶
func WithMediaConfig(mediaRoot, mediaServePath string) HandlerOption
func WithStaticPath ¶
func WithStaticPath(staticServePath string) HandlerOption
func WithVersion ¶
func WithVersion(version string) HandlerOption
type Middlewares ¶
type Middlewares struct {
loggerrific.Logger
}
func NewMiddlewares ¶
func NewMiddlewares(logger loggerrific.Logger) *Middlewares
func (*Middlewares) LoggingMiddleware ¶
func (m *Middlewares) LoggingMiddleware(next http.Handler) http.Handler
Click to show internal directories.
Click to hide internal directories.