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:
@@ -21,7 +21,7 @@ func newApp() *iris.Application {
|
||||
ctx.Writef("Hello %s", ctx.Params().Get("username"))
|
||||
})
|
||||
|
||||
app.HandleDir("/", "./public")
|
||||
app.HandleDir("/", iris.Dir("./public"))
|
||||
|
||||
myOtherHandler := func(ctx iris.Context) {
|
||||
ctx.Writef("inside a handler which is fired manually by our custom router wrapper")
|
||||
|
||||
@@ -48,17 +48,17 @@ func main() {
|
||||
|
||||
// GET: http://localhost:8080/assets/css/main.css
|
||||
// maps to ./public/assets/css/main.css file at system location.
|
||||
app.HandleDir("/assets", "./public/assets")
|
||||
app.HandleDir("/assets", iris.Dir("./public/assets"))
|
||||
|
||||
/* OR
|
||||
|
||||
// GET: http://localhost:8080/css/main.css
|
||||
// maps to ./public/assets/css/main.css file at system location.
|
||||
app.HandleDir("/css", "./public/assets/css")
|
||||
app.HandleDir("/css", iris.Dir("./public/assets/css"))
|
||||
|
||||
// GET: http://localhost:8080/css/bootstrap.min.css
|
||||
// maps to ./public/assets/css/bootstrap.min.css file at system location.
|
||||
app.HandleDir("/css", "./public/assets/css")
|
||||
app.HandleDir("/css", iris.Dir("./public/assets/css"))
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ func main() {
|
||||
* Setup static files
|
||||
*/
|
||||
|
||||
app.HandleDir("/assets", "./public/assets")
|
||||
app.HandleDir("/upload_resources", "./public/upload_resources")
|
||||
app.HandleDir("/assets", iris.Dir("./public/assets"))
|
||||
app.HandleDir("/upload_resources", iris.Dir("./public/upload_resources"))
|
||||
|
||||
dashboard := app.Party("dashboard.")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user