routing

package
v1.76.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2018 License: AGPL-3.0 Imports: 30 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) error

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) error

AddPrivate endpoint

func AddPublic added in v1.59.0

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

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