routing

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RoutePrefixPublic used for the unsecured api
	RoutePrefixPublic = "/api/public/"
	// RoutePrefixPrivate used for secured api (requiring api)
	RoutePrefixPrivate = "/api/"
	// RoutePrefixRoot used for unsecured endpoints at root (e.g. robots.txt)
	RoutePrefixRoot = "/"
	// RoutePrefixTesting used for isolated testing of routes with custom middleware
	RoutePrefixTesting = "/testing/"
)

Variables

This section is empty.

Functions

func Add

func Add(rt *env.Runtime, prefix, path string, methods, queries []string, endPtFn RouteFunc) error

Add an endpoint to those that will be processed when Serve() is called.

func BuildRoutes

func BuildRoutes(rt *env.Runtime, prefix string) *mux.Router

BuildRoutes returns all matching routes for specified scope.

func RegisterEndpoints

func RegisterEndpoints(rt *env.Runtime, s *domain.Store)

RegisterEndpoints register routes for serving API endpoints

func Remove

func Remove(rt *env.Runtime, prefix, path string, methods, queries []string) error

Remove an endpoint.

Types

type RouteFunc

type RouteFunc func(http.ResponseWriter, *http.Request)

RouteFunc describes end-point functions

Jump to

Keyboard shortcuts

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