package
7.2.0+incompatible
Repository: https://github.com/godofdream/siris.git
Documentation: pkg.go.dev
# Functions
Abs calls filepath.Abs but ignores the error and returns the original value if any error occurred.
DirectoryExists returns true if a directory(or file) exists, otherwise false.
NewAPIBuilder creates & returns a new builder which is responsible to build the API and the router handler.
NewDefaultHandler returns the handler which is responsible to map the request with a route (aka mux implementation).
NewRoute returns a new route based on its method, subdomain, the path (unparsed or original), handlers and the macro container which all routes should share.
NewRoutePathReverser returns a new path reverser based on a routes provider, needed to get a route based on its name.
NewRouter returns a new empty Router.
NewSPABuilder returns a new Single Page Application builder It does what StaticWeb expected to do when serving files and routes at the same time from the root "/" path.
NewStaticHandlerBuilder returns a new Handler which serves static files supports gzip, no listing and much more Note that, this static builder returns a Handler it doesn't cares about the rest of your iris configuration.
NewWrapper returns a new http.Handler wrapped by the 'wrapperFunc' the "next" is the final "wrapped" input parameter.
Param receives a parameter name prefixed with the ParamStart symbol.
Prioritize is a middleware which executes a route against this path when the request's Path has a prefix of the route's STATIC PART is not executing ExecRoute to determinate if it's valid, for performance reasons if this function is not enough for you and you want to test more than one parameterized path then use the: if c := ExecRoute(r); c == nil { /* move to the next, the route is not valid */ }
You can find the Route by siris.Default.Routes().Lookup("theRouteName") you can set a route name as: myRoute := siris.Default.Get("/mypath", handler)("theRouteName") that will set a name to the route and returns its siris.Route instance for further usage.
ResolveStaticPath receives a (dynamic) path and tries to return its static path part.
StaticEmbeddedHandler returns a Handler which can serve embedded into executable files.
StaticHandler returns a new Handler which is ready to serve all kind of static files.
StripPrefix returns a handler that serves HTTP requests by removing the given prefix from the request URL's Path and invoking the handler h.
TypeByExtension returns the MIME type associated with the file extension ext.
TypeByFilename same as TypeByExtension but receives a filename path instead.
WildcardParam receives a parameter name prefixed with the WildcardParamStart symbol.
WithHost enables the RoutePathReverser's URL feature.
WithScheme is an option for the RoutepathReverser, it sets the optional field "vscheme", v for virtual.
WithServer enables the RoutePathReverser's URL feature.
# Constants
DynamicSubdomainIndicator where a registered path starts with '*.' then it contains a dynamic subdomain, if subdomain == "*." then its dynamic
used internally by URLPath and the router serve.
MethodNone is a Virtual method to store the "offline" routes.
ParamStart the character in string representation where the underline router starts its dynamic named parameter.
SubdomainIndicator where './' exists in a registered path then it contains subdomain
used on router builder.
WildcardParamStart the character in string representation where the underline router starts its dynamic wildcard path parameter.
# Variables
AllMethods contains the valid http methods: "GET", "POST", "PUT", "DELETE", "CONNECT", "HEAD", "PATCH", "OPTIONS", "TRACE".
StaticCacheDuration expiration duration for INACTIVE file handlers, it's the only one global configuration which can be changed.
# Structs
APIBuilder the visible API for constructing the router and child routers.
ErrorCodeHandler is the entry of the list of all http error code handlers.
ErrorCodeHandlers contains the http error code handlers.
Route contains the information about a registered Route.
RoutePathReverser contains methods that helps to reverse a (dynamic) path from a specific route, route name is required because a route may being registered on more than one http method.
Router is the "director".
SPABuilder helps building a single page application server which serves both routes and files from the root path.
# Interfaces
Party is just a group joiner of routes which have the same prefix and share same middleware(s) also.
RequestHandler the middle man between acquiring a context and releasing it.
RoutesProvider should be implemented by iteral which contains the registered routes.
StaticHandlerBuilder is the web file system's Handler builder use that or the siris.StaticHandler/StaticWeb methods.
# Type aliases
AssetValidator returns true if "filename" is asset, i.e: strings.Contains(filename, ".").
RoutePathReverserOption option signature for the RoutePathReverser.
WrapperFunc is used as an expected input parameter signature for the WrapRouter.