Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type SPA ¶
type SPA struct {
// contains filtered or unexported fields
}
func NewSPA ¶
NewSPA serves the provided directory as a Single-Page Application. Read more on how the app is actually served in `routes.SPA.ServeHTTP`.
func (SPA) ServeHTTP ¶
func (spa SPA) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP inspects the URL path to locate a file within the static dir on the SPA handler. If a file is found, it will be served. If not, the file located at the index path on the SPA handler will be served. This is suitable behavior for serving an SPA (single page application). HTML, plaintext and JSON files will NEVER cache to guarantee an always up-to-date app. Will cache JS and CSS files forever since we assume their file names are/contain content hashes.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.