router

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

type Router interface {

	// Sets the not-found handler (this handler is called when no other handlers/routes in the routing library match
	SetNotFound(http.Handler) error

	// Gets the not-found handler that is currently in use by this router.
	GetNotFound() http.Handler

	// Validates whether this is an acceptable route expression
	IsValid(string) bool

	// Adds a new route->handler combination. The route is a string which provides the routing expression. http.Handler is called when this expression matches a request.
	Handle(string, http.Handler) error

	// Adds a map of handlers and expressions in a single call.
	InitHandlers(map[string]interface{}) error

	// Removes a route. The http.Handler associated with it, will be discarded.
	Remove(string) error

	// ServiceHTTP is the http.Handler implementation that allows callers to route their calls to sub-http.Handlers based on route matches.
	ServeHTTP(http.ResponseWriter, *http.Request)

	// Adds aliases for expressions
	AddAlias(string, string)
}

This interface captures all routing functionality required by vulcan. The routing functionality mainly comes from "github.com/vulcand/route",

Jump to

Keyboard shortcuts

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