Documentation ¶
Overview ¶
`go-http-leaflet-layers` is an HTTP middleware package for including LeafletLayers.js assets in web applications. It exports two principal methods:
* `layers.AppendAssetHandlers(*http.ServeMux)` which is used to append HTTP handlers to a `http.ServeMux` instance for serving LeafletLayers JavaScript files, and related assets. * `layers.AppendResourcesHandler(http.Handler, *LeafletLayersOptions)` which is used to rewrite any HTML produced by previous handler to include the necessary markup to load LeafletLayers JavaScript files and related assets.
Index ¶
- Variables
- func AppendAssetHandlers(mux *http.ServeMux) error
- func AppendAssetHandlersWithPrefix(mux *http.ServeMux, prefix string) error
- func AppendResourcesHandler(next http.Handler, opts *LeafletLayersOptions) http.Handler
- func AppendResourcesHandlerWithPrefix(next http.Handler, opts *LeafletLayersOptions, prefix string) http.Handler
- func AssetsHandler() (http.Handler, error)
- func AssetsHandlerWithPrefix(prefix string) (http.Handler, error)
- type LeafletLayersOptions
Constants ¶
This section is empty.
Variables ¶
var APPEND_LEAFLET_ASSETS = true
By default the go-http-protomaps package will also include and reference Leaflet.js assets using the aaronland/go-http-leaflet package. If you want or need to disable this behaviour set this variable to false.
var APPEND_LEAFLET_RESOURCES = true
By default the go-http-protomaps package will also include and reference Leaflet.js resources using the aaronland/go-http-leaflet package. If you want or need to disable this behaviour set this variable to false.
Functions ¶
func AppendAssetHandlers ¶
Append all the files in the net/http FS instance containing the embedded LeafletLayers assets to an *http.ServeMux instance.
func AppendAssetHandlersWithPrefix ¶
Append all the files in the net/http FS instance containing the embedded LeafletLayers assets to an *http.ServeMux instance ensuring that all URLs are prepended with prefix.
func AppendResourcesHandler ¶
func AppendResourcesHandler(next http.Handler, opts *LeafletLayersOptions) http.Handler
AppendResourcesHandler will rewrite any HTML produced by previous handler to include the necessary markup to load LeafletLayers JavaScript files and related assets.
func AppendResourcesHandlerWithPrefix ¶
func AppendResourcesHandlerWithPrefix(next http.Handler, opts *LeafletLayersOptions, prefix string) http.Handler
AppendResourcesHandlerWithPrefix will rewrite any HTML produced by previous handler to include the necessary markup to load LeafletLayers JavaScript files and related assets ensuring that all URIs are prepended with a prefix.
func AssetsHandler ¶
AssetsHandler returns a net/http FS instance containing the embedded LeafletLayers assets that are included with this package.
Types ¶
type LeafletLayersOptions ¶
LeafletLayersOptions provides a list of JavaScript and CSS link to include with HTML output.
func DefaultLeafletLayersOptions ¶
func DefaultLeafletLayersOptions() *LeafletLayersOptions
Return a *LeafletLayersOptions struct with default paths and URIs.