handler

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package handler evaluates site requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(gameCount int, time func() string, f FreeSpacer) (http.Handler, error)

Handler creates a HTTP handler to serve the site. The gameCount and time function are validated used from the config in the handler Responses are returned gzip compression when allowed.

func WithGzip

func WithGzip(h http.Handler) http.Handler

WithGzip wraps the handler with a handler that writes responses using gzip compression when accepted.

Types

type FreeSpacer

type FreeSpacer interface {
	// QRCode encodes the board id to a QR code with a width and height.
	QRCode(boardID string, width, height int) (image.Image, error)
}

FreeSpacer generates the free space image for a board.

type HTTPSRedirectPort

type HTTPSRedirectPort string

HTTPSRedirectPort is a handler that redirects requests to HTTPS uris.

func (HTTPSRedirectPort) ServeHTTP

func (port HTTPSRedirectPort) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP redirects requests to HTTPS on the port if it is not standard (443).

type Mux

type Mux map[string]map[string]http.HandlerFunc

Mux is http Handler that is a map of methods to path handler maps

func (Mux) ServeHTTP

func (m Mux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves to the path for the method of the request on the handler if such a Handler exists.

Directories

Path Synopsis
Package qr encodes board text into images
Package qr encodes board text into images

Jump to

Keyboard shortcuts

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