gospa

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2019 License: MIT Imports: 12 Imported by: 0

README

gospa

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeFile

func ServeFile(w http.ResponseWriter, r *http.Request, fileSystem http.FileSystem, fileName string, prefix string) ([]byte, error)

ServeFile from a http.FileSystem

Types

type FileSystems

type FileSystems []http.FileSystem

FileSystems is a wrapper for multiple http.FileSystem

func (FileSystems) Open

func (f FileSystems) Open(name string) (http.File, error)

Open a file from the first http.FileSystem it is found in

type SPA

type SPA struct {
	FileSystem http.FileSystem
	Index      string
	// contains filtered or unexported fields
}

SPA is an http.Handler that serves static files from a http.FileSystem. If a static file can not be found, the index file is served.

func (*SPA) EnableCSP

func (s *SPA) EnableCSP() error

EnableCSP generates saves the CSP header to be added to requests of the index file

func (SPA) ServeHTTP

func (s SPA) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP satisfies the http.Handler interface

Jump to

Keyboard shortcuts

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