Documentation
¶
Index ¶
- Constants
- func GetCachingMiddleware(cacheStore CacheStore) func(http.Handler) http.Handler
- func GetLoggingMiddleware(logger loggerrific.Logger) func(http.Handler) http.Handler
- 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 CacheStore
- type Handler
- type HandlerOption
- type Middlewares
- type Payload
Constants ¶
View Source
const ( StaticPath = "/static" PodcastPath = "/podcast" MediaPath = "/media" PodcastFeedName = "feed.rss" )
View Source
const ( ContentTypeHeader = "Content-Type" ContentTypeXML = "application/xml; charset=utf-8" ContentTypeTextXML = "text/xml; charset=utf-8" ContentTypeJSON = "application/json; charset=utf-8" ContentTypeHTML = "text/html" )
Variables ¶
This section is empty.
Functions ¶
func GetCachingMiddleware ¶ added in v1.13.2
func GetCachingMiddleware(cacheStore CacheStore) func(http.Handler) http.Handler
func GetLoggingMiddleware ¶ added in v1.13.2
func SendJSONError ¶
func SendJSONError(w http.ResponseWriter, status int, err error)
Types ¶
type AudiobooksPodcastService ¶
type AudiobooksPodcastService interface { WriteAllAudiobooksFeed(context.Context, io.Writer) error WriteGenreAudiobookFeed(context.Context, audiobooks.Genre, io.Writer) error WriteAuthorAudiobookFeed(context.Context, string, io.Writer) (bool, error) WriteNarratorAudiobookFeed(context.Context, string, io.Writer) (bool, error) WriteTagAudiobookFeed(context.Context, string, io.Writer) (bool, error) UpdateFeeds(context.Context) error IsReady(ctx context.Context) bool }
type CacheStore ¶ added in v1.11.0
type Handler ¶
type Handler struct { *chi.Mux PodcastService AudiobooksPodcastService CacheStore CacheStore Log loggerrific.Logger // contains filtered or unexported fields }
func NewHandler ¶
func NewHandler(podcastService AudiobooksPodcastService, mediaRoot string, opts ...HandlerOption) *Handler
type HandlerOption ¶
type HandlerOption func(h *Handler)
func WithCacheStore ¶ added in v1.13.2
func WithCacheStore(cacheStore CacheStore) HandlerOption
func WithLogger ¶ added in v1.13.2
func WithLogger(logger loggerrific.Logger) HandlerOption
func WithVersion ¶
func WithVersion(version string) HandlerOption
type Middlewares ¶
type Middlewares struct { loggerrific.Logger CacheStore }
Click to show internal directories.
Click to hide internal directories.