http

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

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 SendJSON

func SendJSON(writer http.ResponseWriter, status int, p any)

func SendJSONError

func SendJSONError(w http.ResponseWriter, status int, err error)

func Serve

func Serve(handler http.Handler, port int, logger loggerrific.Logger) error

func SevereRateLimitMiddleware

func SevereRateLimitMiddleware(next http.Handler) http.Handler

func TimeoutMiddleware

func TimeoutMiddleware(next http.Handler) http.Handler

Types

type AudiobooksPodcastService

type AudiobooksPodcastService interface {
	WriteAllAudiobooksFeed(ctx context.Context, w io.Writer) error
	IsReady(ctx context.Context) bool
}

type AudiobooksUpdateService

type AudiobooksUpdateService interface {
	UpdateAudiobooks(ctx context.Context) error
	IsReady(ctx context.Context) bool
}

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

type Payload

type Payload map[string]any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL