Versions in this module Expand all Collapse all v12 v12.1.9 Aug 12, 2022 Changes in this version + const MethodNone + const ParamStart + const SubdomainPrefix + const SubdomainWildcardIndicator + const SubdomainWildcardPrefix + const WildcardParamStart + var AllMethods = []string + var ErrNotRouteAdder = errors.New("request handler does not implement AddRoute method") + func Abs(path string) string + func DirectoryExists(dir string) bool + func FileServer(directory string, opts ...DirOptions) context.Handler + func NewWrapper(...) http.Handler + func Param(name string) string + func StripPrefix(prefix string, h context.Handler) context.Handler + func TypeByExtension(ext string) (typ string) + func TypeByFilename(fullFilename string) string + func WildcardFileParam() string + func WildcardParam(name string) string + type APIBuilder struct + func NewAPIBuilder() *APIBuilder + func (api *APIBuilder) AllowMethods(methods ...string) Party + func (api *APIBuilder) Any(relativePath string, handlers ...context.Handler) (routes []*Route) + func (api *APIBuilder) Connect(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) CreateRoutes(methods []string, relativePath string, handlers ...context.Handler) []*Route + func (api *APIBuilder) Delete(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) Done(handlers ...context.Handler) + func (api *APIBuilder) DoneGlobal(handlers ...context.Handler) + func (api *APIBuilder) Favicon(favPath string, requestPath ...string) *Route + func (api *APIBuilder) FireErrorCode(ctx context.Context) + func (api *APIBuilder) Get(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) GetRelPath() string + func (api *APIBuilder) GetReporter() *errgroup.Group + func (api *APIBuilder) GetRoute(routeName string) *Route + func (api *APIBuilder) GetRouteByPath(tmplPath string) *Route + func (api *APIBuilder) GetRouteReadOnly(routeName string) context.RouteReadOnly + func (api *APIBuilder) GetRouteReadOnlyByPath(tmplPath string) context.RouteReadOnly + func (api *APIBuilder) GetRoutes() []*Route + func (api *APIBuilder) GetRoutesReadOnly() []context.RouteReadOnly + func (api *APIBuilder) Handle(method string, relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) HandleDir(requestPath, directory string, opts ...DirOptions) (getRoute *Route) + func (api *APIBuilder) HandleMany(methodOrMulti string, relativePathorMulti string, handlers ...context.Handler) (routes []*Route) + func (api *APIBuilder) Head(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) Layout(tmplLayoutFile string) Party + func (api *APIBuilder) Macros() *macro.Macros + func (api *APIBuilder) None(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) OnAnyErrorCode(handlers ...context.Handler) + func (api *APIBuilder) OnErrorCode(statusCode int, handlers ...context.Handler) + func (api *APIBuilder) Options(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) Party(relativePath string, handlers ...context.Handler) Party + func (api *APIBuilder) PartyFunc(relativePath string, partyBuilderFunc func(p Party)) Party + func (api *APIBuilder) Patch(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) Post(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) Put(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) Reset() Party + func (api *APIBuilder) SetExecutionRules(executionRules ExecutionRules) Party + func (api *APIBuilder) SetRegisterRule(rule RouteRegisterRule) Party + func (api *APIBuilder) StaticContent(reqPath string, cType string, content []byte) *Route + func (api *APIBuilder) Subdomain(subdomain string, middleware ...context.Handler) Party + func (api *APIBuilder) Trace(relativePath string, handlers ...context.Handler) *Route + func (api *APIBuilder) Use(handlers ...context.Handler) + func (api *APIBuilder) UseGlobal(handlers ...context.Handler) + func (api *APIBuilder) WildcardSubdomain(middleware ...context.Handler) Party + type DirOptions struct + Asset func(name string) ([]byte, error) + AssetInfo func(name string) (os.FileInfo, error) + AssetNames func() []string + AssetValidator func(ctx context.Context, name string) bool + DirList func(ctx context.Context, dirName string, dir http.File) error + Gzip bool + IndexName string + ShowList bool + type ErrorCodeHandler struct + Handlers context.Handlers + StatusCode int + func (ch *ErrorCodeHandler) Fire(ctx context.Context) + type ErrorCodeHandlers struct + func (s *ErrorCodeHandlers) Fire(ctx context.Context) + func (s *ErrorCodeHandlers) Get(statusCode int) *ErrorCodeHandler + func (s *ErrorCodeHandlers) Register(statusCode int, handlers ...context.Handler) *ErrorCodeHandler + type ExecutionOptions struct + Force bool + type ExecutionRules struct + Begin ExecutionOptions + Done ExecutionOptions + Main ExecutionOptions + type Party interface + AllowMethods func(methods ...string) Party + Any func(registeredPath string, handlers ...context.Handler) []*Route + Connect func(path string, handlers ...context.Handler) *Route + CreateRoutes func(methods []string, relativePath string, handlers ...context.Handler) []*Route + Delete func(path string, handlers ...context.Handler) *Route + Done func(handlers ...context.Handler) + Favicon func(favPath string, requestPath ...string) *Route + Get func(path string, handlers ...context.Handler) *Route + GetRelPath func() string + GetReporter func() *errgroup.Group + Handle func(method string, registeredPath string, handlers ...context.Handler) *Route + HandleDir func(requestPath, directory string, opts ...DirOptions) *Route + HandleMany func(method string, relativePath string, handlers ...context.Handler) []*Route + Head func(path string, handlers ...context.Handler) *Route + Layout func(tmplLayoutFile string) Party + Macros func() *macro.Macros + None func(path string, handlers ...context.Handler) *Route + Options func(path string, handlers ...context.Handler) *Route + Party func(relativePath string, middleware ...context.Handler) Party + PartyFunc func(relativePath string, partyBuilderFunc func(p Party)) Party + Patch func(path string, handlers ...context.Handler) *Route + Post func(path string, handlers ...context.Handler) *Route + Put func(path string, handlers ...context.Handler) *Route + Reset func() Party + SetExecutionRules func(executionRules ExecutionRules) Party + SetRegisterRule func(rule RouteRegisterRule) Party + StaticContent func(requestPath string, cType string, content []byte) *Route + Subdomain func(subdomain string, middleware ...context.Handler) Party + Trace func(path string, handlers ...context.Handler) *Route + Use func(middleware ...context.Handler) + type RequestHandler interface + Build func(provider RoutesProvider) error + HandleRequest func(context.Context) + RouteExists func(ctx context.Context, method, path string) bool + func NewDefaultHandler() RequestHandler + type Route struct + ChangeFreq string + FormattedPath string + Handlers context.Handlers + LastMod time.Time + MainHandlerName string + Method string + Name string + Path string + Priority float32 + SourceFileName string + SourceLineNumber int + StaticSites []context.StaticSite + Subdomain string + func NewRoute(method, subdomain, unparsedPath, mainHandlerName string, ...) (*Route, error) + func (r *Route) BuildHandlers() + func (r *Route) ChangeMethod(newMethod string) bool + func (r *Route) DeepEqual(other *Route) bool + func (r *Route) Done(handlers ...context.Handler) + func (r *Route) Equal(other *Route) bool + func (r *Route) IsOnline() bool + func (r *Route) IsStatic() bool + func (r *Route) RegisteredHandlersLen() int + func (r *Route) ResolvePath(args ...string) string + func (r *Route) RestoreStatus() bool + func (r *Route) SetChangeFreq(freq string) *Route + func (r *Route) SetLastMod(t time.Time) *Route + func (r *Route) SetPriority(prio float32) *Route + func (r *Route) SetStatusOffline() bool + func (r *Route) StaticPath() string + func (r *Route) String() string + func (r *Route) Tmpl() macro.Template + func (r *Route) Trace() string + func (r *Route) Use(handlers ...context.Handler) + type RoutePathReverser struct + func NewRoutePathReverser(apiRoutesProvider RoutesProvider, options ...RoutePathReverserOption) *RoutePathReverser + func (ps *RoutePathReverser) Path(routeName string, paramValues ...interface{}) string + func (ps *RoutePathReverser) URL(routeName string, paramValues ...interface{}) (url string) + type RoutePathReverserOption func(*RoutePathReverser) + func WithHost(host string) RoutePathReverserOption + func WithScheme(scheme string) RoutePathReverserOption + func WithServer(srv *http.Server) RoutePathReverserOption + type RouteRegisterRule uint8 + const RouteError + const RouteOverride + const RouteSkip + type Router struct + func NewRouter() *Router + func (router *Router) AddRouteUnsafe(r *Route) error + func (router *Router) BuildRouter(cPool *context.Pool, requestHandler RequestHandler, ...) error + func (router *Router) Downgrade(newMainHandler http.HandlerFunc) + func (router *Router) Downgraded() bool + func (router *Router) FindClosestPaths(subdomain, searchPath string, n int) []string + func (router *Router) RefreshRouter() error + func (router *Router) RouteExists(ctx context.Context, method, path string) bool + func (router *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (router *Router) ServeHTTPC(ctx context.Context) + func (router *Router) WrapRouter(wrapperFunc WrapperFunc) + type RoutesProvider interface + GetRoute func(routeName string) *Route + GetRoutes func() []*Route + type WrapperFunc func(w http.ResponseWriter, r *http.Request, firstNextIsTheRouter http.HandlerFunc) + func NewSubdomainRedirectWrapper(rootDomainGetter func() string, from, to string) WrapperFunc