layers

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: BSD-3-Clause Imports: 9 Imported by: 1

README

go-http-leaflet-layers

Go HTTP middleware for the leaflet.layers.control plugin.

Documentation

Go Reference

Documentation is incomplete.

See also

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

Constants

This section is empty.

Variables

View Source
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.

View Source
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

func AppendAssetHandlers(mux *http.ServeMux) error

Append all the files in the net/http FS instance containing the embedded LeafletLayers assets to an *http.ServeMux instance.

func AppendAssetHandlersWithPrefix

func AppendAssetHandlersWithPrefix(mux *http.ServeMux, prefix string) error

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

func AssetsHandler() (http.Handler, error)

AssetsHandler returns a net/http FS instance containing the embedded LeafletLayers assets that are included with this package.

func AssetsHandlerWithPrefix

func AssetsHandlerWithPrefix(prefix string) (http.Handler, error)

AssetsHandler returns a net/http FS instance containing the embedded LeafletLayers assets that are included with this package ensuring that all URLs are stripped of prefix.

Types

type LeafletLayersOptions

type LeafletLayersOptions struct {
	JS  []string
	CSS []string
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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