1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00

fix embedded fs not access to dir list because of options.ShowList unnecessary check. Solves #1383

Former-commit-id: 1ad4535deb1c4792408a3bf63456b333aa752594
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-10-25 01:04:08 +03:00
parent 221978e41a
commit 0e2c44e231
7 changed files with 192 additions and 76 deletions

View File

@@ -15,7 +15,8 @@ type User struct {
func main() {
app := iris.New()
// app.Logger().SetLevel("disable") to disable the logger
app.Logger().SetLevel("debug")
// app.Logger().SetLevel("disable") to disable the logger.
// Define templates using the std html/template engine.
// Parse and load all files inside "./views" folder with ".html" file extension.
@@ -73,6 +74,14 @@ func main() {
usersRoutes.Post("/create", createUser)
}
app.Get("/", func(ctx iris.Context) {
ctx.HTML("<html><head></head><body><ul>")
for _, link := range []string{"/encode", "/profile/username", "/users/42"} {
ctx.HTML(`<li><a href="%s">%s</a></li>`, link, link)
}
ctx.HTML("</ul></body></html>")
})
// Listen for incoming HTTP/1.x & HTTP/2 clients on localhost port 8080.
app.Run(iris.Addr(":8080"), iris.WithCharset("UTF-8"))
}