urlShortener

package
v0.0.0-...-8e4b3ea Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapHandler

func MapHandler(pathsToUrls map[string]string, fallback http.Handler) http.HandlerFunc

MapHandler will return an http.HandlerFunc (which also implements http.Handler) that will attempt to map any paths (keys in the map) to their corresponding URL (values that each key in the map points to, in string format). If the path is not provided in the map, then the fallback http.Handler will be called instead.

func UrlShortProgram

func UrlShortProgram()

func YAMLHandler

func YAMLHandler(yml []byte, fallback http.Handler) (http.HandlerFunc, error)

Types

type PathUrl

type PathUrl struct {
	Path string `yaml:"path"`
	URL  string `yaml:"url"`
}

Jump to

Keyboard shortcuts

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