Documentation
¶
Overview ¶
Package spa creates a set of middlewares for use when serving a Single Page Application from an API server.
The problem with `echo.middleware.Static` is that it doesn't handle non-root routes, so you end up with 404s/403s/whatever, instead of redirecting to serving the index.html file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(static echo.MiddlewareFunc, handle Matcher) echo.MiddlewareFunc
func MiddlewareWithConfig ¶
func MiddlewareWithConfig(cfg Config) echo.MiddlewareFunc
Types ¶
type Config ¶
type Config struct {
// If Handle returns true, the route is treated as a static route (passed to the Static middleware).
// Required.
Handle Matcher
// The middleware used for handling static routes.
// See echo.middleware.Static for info on configuration.
// Required.
Static echo.MiddlewareFunc
// When Handle returns true, this is the path passed to the Static middleware.
// Defaults to index.html.
Path string
}
Click to show internal directories.
Click to hide internal directories.