static

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DocsCacheMaxAge is the cache max age used when serving the docs.
	DocsCacheMaxAge = 15 * time.Minute

	// StaticCacheMaxAge is the cache max age used when serving static assets.
	StaticCacheMaxAge = 365 * 24 * time.Hour
)

Variables

This section is empty.

Functions

func FileServer

func FileServer(r chi.Router, public, static string, cacheMaxAge time.Duration)

FileServer sets up a http.FileServer handler to serve static files.

Types

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

Handlers represents a group of http handlers in charge of handling static files operations.

func NewHandlers

func NewHandlers(cfg *viper.Viper, imageStore img.Store) *Handlers

NewHandlers creates a new Handlers instance.

func (*Handlers) Image

func (h *Handlers) Image(w http.ResponseWriter, r *http.Request)

Image is an http handler that serves images stored in the database.

func (*Handlers) Index added in v0.20.0

func (h *Handlers) Index(w http.ResponseWriter, r *http.Request)

Index is an http handler that serves the index.html file.

func (*Handlers) SaveImage

func (h *Handlers) SaveImage(w http.ResponseWriter, r *http.Request)

SaveImage is an http handler that stores the provided image returning its id.

Jump to

Keyboard shortcuts

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