routing

package
v2.4.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: AGPL-3.0 Imports: 31 Imported by: 5 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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