1
0
mirror of https://github.com/labstack/echo.git synced 2025-11-06 08:59:21 +02:00

Added directory autoindex

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2015-11-23 20:33:13 -08:00
parent 9d11990cbb
commit d932e2a863
3 changed files with 91 additions and 8 deletions

View File

@@ -37,6 +37,24 @@ SetOutput sets the output destination for the global logger.
SetLogLevel sets the log level for global logger. The default value is `log.INFO`.
### Auto index
`Echo#AutoIndex(on bool)`
AutoIndex enables automatically creates a directory listing if the directory doesn't
contain an index page.
*Example*
```go
e := echo.New()
e.AutoIndex(true)
e.ServerDir("/", "/Users/vr/Projects/echo")
e.Run(":1323")
```
Browse to `http://localhost:1323/` to see the directory listing.
### Hook
`Echo#Hook(http.HandlerFunc)`