1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

file-server example: use a custom template for listing dirs/files

Former-commit-id: 5b9bb0be4ac3f5d463f0957a3074aa6e7b1a71f7
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-07-06 16:06:48 +03:00
parent 3ec94b9e4a
commit dd72a1e398
5 changed files with 249 additions and 55 deletions

View File

@@ -395,10 +395,7 @@ func (api *APIBuilder) HandleMany(methodOrMulti string, relativePathorMulti stri
// Examples can be found at: https://github.com/kataras/iris/tree/master/_examples/file-server
func (api *APIBuilder) HandleDir(requestPath, directory string, opts ...DirOptions) (routes []*Route) {
options := getDirOptions(opts...)
// TODO(@kataras): Add option(s) to enable file & directory deletion (DELETE wildcard route)
// and integrade it with the new `DirListRich` helper
// (either context menu override on right-click of the file name or to a new table column)
// Note that, an auth middleware can be already registered, so no need to add options for that here.
h := FileServer(directory, options)
description := directory
fileName, lineNumber := context.HandlerFileLine(h) // take those before StripPrefix.