community: github.com/documize/community/server/routing Index | Files

package routing

import "github.com/documize/community/server/routing"

Index

Package Files

container.go routes.go

Constants

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/"
)

func Add Uses

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 Uses

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

AddPrivate endpoint

func AddPublic Uses

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

AddPublic endpoint

func BuildRoutes Uses

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

BuildRoutes returns all matching routes for specified scope.

func RegisterEndpoints Uses

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

RegisterEndpoints register routes for serving API endpoints

func Remove Uses

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

Remove an endpoint.

type RouteFunc Uses

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

RouteFunc describes end-point functions

Package routing imports 33 packages (graph) and is imported by 1 packages. Updated 2019-09-23. Refresh now. Tools for package owners.