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

@@ -7,7 +7,7 @@ import (
)
var opts = iris.DirOptions{
IndexName: "/index.html",
IndexName: "index.html",
// Optionally register files (map's values) to be served
// when a specific path (map's key WITHOUT prefix) is requested
// is fired before client asks (HTTP/2 Push).
@@ -38,10 +38,15 @@ var opts = iris.DirOptions{
func main() {
app := iris.New()
app.HandleDir("/public", "./assets", opts)
app.HandleDir("/public", iris.Dir("./assets"), opts)
// Open your browser's Network tools,
// navigate to https://127.0.0.1/public.
// you should see `Initiator` tab: "Push / public".
//
// https://127.0.0.1/public
// https://127.0.0.1/public/app2
// https://127.0.0.1/public/app2/app2app3
// https://127.0.0.1/public/app2/app2app3/dirs
app.Run(iris.TLS(":443", "mycert.crt", "mykey.key"))
}