staticfs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package staticfs adapts http.FS to [oakmux.Handler] signature.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = &NotFoundError{}

Functions

This section is empty.

Types

type FS

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

func New

func New(withOptions ...Option) (_ *FS, err error)

func (*FS) ServeHTTP

func (fs *FS) ServeHTTP(
	w http.ResponseWriter,
	r *http.Request,
)

func (*FS) ServeHyperText

func (fs *FS) ServeHyperText(
	w http.ResponseWriter,
	r *http.Request,
) (err error)

func (*FS) String

func (fs *FS) String() string

type NotFoundError

type NotFoundError struct{}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) HyperTextStatusCode

func (e *NotFoundError) HyperTextStatusCode() int

type Option

type Option func(*options) error

func WithDirectory

func WithDirectory(p string) Option

func WithFileSystem

func WithFileSystem(fs fs.FS) Option

func WithPath

func WithPath(external, real string) Option

func WithPathTranslators

func WithPathTranslators(ts ...PathTranslator) Option

type PathTranslator

type PathTranslator func(real string) (external string, accept bool, err error)

Jump to

Keyboard shortcuts

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