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

New DirOptions.Cache field for in-memory caching and pre-compression for the fastest possible static file server

Read HISTORY.md it contains a breaking change, second parameter of HandleDir should be iris.Dir(...) instead of just a string

relative to: https://github.com/kataras/iris/issues/1556#issuecomment-661057446


Former-commit-id: 14b48a06fb3b99287dff543932be2937a64233b9
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-07-24 13:03:49 +03:00
parent d697426cb6
commit c3205dafa1
58 changed files with 2581 additions and 9855 deletions

View File

@@ -114,7 +114,7 @@ func main() {
})
// serves the npm browser websocket client usage example.
app.HandleDir("/browserify", "./browserify")
app.HandleDir("/browserify", iris.Dir("./browserify"))
app.Listen(":8080")
}

View File

@@ -42,7 +42,7 @@ func main() {
log.Printf("[%s] Disconnected from server", c.ID())
}
app.HandleDir("/js", "./static/js") // serve our custom javascript code.
app.HandleDir("/js", iris.Dir("./static/js")) // serve our custom javascript code.
// register the server on an endpoint.
// see the inline javascript code i the websockets.html, this endpoint is used to connect to the server.

View File

@@ -29,7 +29,7 @@ func main() {
app.Get("/my_endpoint", websocket.Handler(ws))
// register static assets request path and system directory
app.HandleDir("/js", "./static/assets/js")
app.HandleDir("/js", iris.Dir("./static/assets/js"))
h := func(ctx iris.Context) {
ctx.ViewData("", page{PageID: "index page"})

View File

@@ -46,7 +46,7 @@ func main() {
defer server.Close()
app.HandleMany("GET POST", "/socket.io/{any:path}", iris.FromStd(server))
app.HandleDir("/", "./asset")
app.HandleDir("/", iris.Dir("./asset"))
app.Listen(":8000", iris.WithoutPathCorrection)
}