routes

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package routes implements registered urls and parameter substitution

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NamedRoutes

type NamedRoutes map[string]Route

NamedRoutes is a map of all named routes, to provide something like https://github.com/gorilla/mux#registered-urls

func (NamedRoutes) Path

func (n NamedRoutes) Path(name string, params ...interface{}) string

Path returns a route's path with params substituted, panics if used inproperly.

type Route

type Route struct {
	Method  string
	Path    string
	Format  string
	Handler http.HandlerFunc
}

Route describes a route for httprouter

func NewRoute

func NewRoute(method string, path string, h http.HandlerFunc) Route

NewRoute returns a new route, which can be added to NamedRoutes and used with httprouter. Trailing and leading slashes are removed.

Jump to

Keyboard shortcuts

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