1
0
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:
Gerasimos (Makis) Maropoulos
2019-06-14 11:26:56 +03:00
parent 272566950d
commit 0f907a3dae
8 changed files with 87 additions and 23 deletions

View File

@@ -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())`.
//

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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"`

View File

@@ -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