routing

package
v3.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2019 License: AGPL-3.0 Imports: 33 Imported by: 3

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)

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

func AddPrivate added in v1.59.0

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

AddPrivate endpoint

func AddPublic added in v1.59.0

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

AddPublic endpoint

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 *store.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