Help us shape the future of Go! Take the 2026 Go Developer Survey

spaassets

package module
v0.0.0-...-583a733 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2016 License: MIT Imports: 4 Imported by: 0

README

spaassets

import "github.com/jtwatson/spaassets"

Overview

Index

Package files

middleware.go

func DeepLink(next http.Handler, appURL string) http.Handler

DeepLink middleware handles deep-linking into a single page application (SPA).

This middleware should wrap your asset handler, and expects all requests are requesting a file with an extention. (ie: .js, .html, .png, .jpg etc)

If it recieves a request targeting a directory (with or without a trailing '/'), it will rewrite the request to target appURL

appURL should be the location of the SPA

func MaxAgeCacheHandler

func MaxAgeCacheHandler(next http.Handler, age int, include bool, prefix string) http.Handler

MaxAgeCacheHandler applies Cache-control: max-age= header according to options.

Options age: cache experation in seconds include: indicates if matches should be included/excluded. prefix: prefix is matched to the beginning of url.

func NoStoreCacheHandler

func NoStoreCacheHandler(next http.Handler, include bool, prefix string) http.Handler

NoStoreCacheHandler applies Cache-control: no-store header according to options.

Options include: indicates if matches should be included/excluded. prefix: prefix is matched to the beginning of url.


Generated by godoc2md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepLink(next http.Handler, appURL string) http.Handler

DeepLink middleware handles deep-linking into a single page application (SPA).

This middleware should wrap your asset handler, and expects all requests are requesting a file with an extention. (ie: .js, .html, .png, .jpg etc)

If it recieves a request targeting a directory (with or without a trailing '/'), it will rewrite the request to target appURL

appURL should be the location of the SPA

func MaxAgeCacheHandler

func MaxAgeCacheHandler(next http.Handler, age int, include bool, prefix string) http.Handler

MaxAgeCacheHandler applies Cache-control: max-age=<age> header according to options.

Options age: cache experation in seconds include: indicates if matches should be included/excluded. prefix: prefix is matched to the beginning of url.

func NoStoreCacheHandler

func NoStoreCacheHandler(next http.Handler, include bool, prefix string) http.Handler

NoStoreCacheHandler applies Cache-control: no-store header according to options.

Options include: indicates if matches should be included/excluded. prefix: prefix is matched to the beginning of url.

Types

This section is empty.

Jump to

Keyboard shortcuts

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