mirror of
https://github.com/kataras/iris.git
synced 2025-12-23 12:57:05 +00:00
Former-commit-id: 2b48b9b912e9eb8f5f2c6d413907dbfdae857e08
This commit is contained in:
@@ -798,7 +798,9 @@ func (api *APIBuilder) Favicon(favPath string, requestPath ...string) *Route {
|
||||
//
|
||||
// As a special case, the returned file server redirects any request
|
||||
// ending in "/index.html" to the same path, without the final
|
||||
// "index.html".
|
||||
// "/index.html", if `index.html` should be served then register a
|
||||
// new route for it, i.e
|
||||
// `app.Get("/static", func(ctx iris.Context){ ctx.ServeFile("./static/index.html", false) })`.
|
||||
//
|
||||
// StaticWeb calls the `StripPrefix(fullpath, NewStaticHandlerBuilder(systemPath).Listing(false).Build())`.
|
||||
//
|
||||
|
||||
@@ -127,7 +127,7 @@ func StaticEmbeddedHandler(vdir string, assetFn func(name string) ([]byte, error
|
||||
// fileserver := iris.StaticHandler("./static_files", false, false)
|
||||
// h := router.StripPrefix("/static", fileserver)
|
||||
// /* http://mydomain.com/static/css/style.css */
|
||||
// app.Get("/static", h)
|
||||
// app.Get("/static/{file:path}", h)
|
||||
// ...
|
||||
//
|
||||
func StaticHandler(systemPath string, showList bool, gzip bool) context.Handler {
|
||||
|
||||
@@ -82,7 +82,7 @@ func (h *routerHandler) Build(provider RoutesProvider) error {
|
||||
registeredRoutes := provider.GetRoutes()
|
||||
h.trees = h.trees[0:0] // reset, inneed when rebuilding.
|
||||
|
||||
// sort, subdomains goes first.
|
||||
// sort, subdomains go first.
|
||||
sort.Slice(registeredRoutes, func(i, j int) bool {
|
||||
first, second := registeredRoutes[i], registeredRoutes[j]
|
||||
lsub1 := len(first.Subdomain)
|
||||
|
||||
@@ -28,7 +28,8 @@ type Route struct {
|
||||
// temp storage, they're appended to the Handlers on build.
|
||||
// Execution happens after Begin and main Handler(s), can be empty.
|
||||
doneHandlers context.Handlers
|
||||
Path string `json:"path"` // "/api/user/:id"
|
||||
|
||||
Path string `json:"path"` // "/api/user/{id:uint64}"
|
||||
// FormattedPath all dynamic named parameters (if any) replaced with %v,
|
||||
// used by Application to validate param values of a Route based on its name.
|
||||
FormattedPath string `json:"formattedPath"`
|
||||
|
||||
@@ -93,7 +93,7 @@ func (router *Router) BuildRouter(cPool *context.Pool, requestHandler RequestHan
|
||||
}
|
||||
|
||||
// Downgrade "downgrades", alters the router supervisor service(Router.mainHandler)
|
||||
// algorithm to a custom one,
|
||||
// algorithm to a custom one,
|
||||
// be aware to change the global variables of 'ParamStart' and 'ParamWildcardStart'.
|
||||
// can be used to implement a custom proxy or
|
||||
// a custom router which should work with raw ResponseWriter, *Request
|
||||
|
||||
Reference in New Issue
Block a user