mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 10:27:06 +00:00
(#1554) Add support for all common compressions (write and read)
- Remove the context.Context interface and export the *context, the iris.Context now points to the pointer\nSupport compression and rate limiting in the FileServer\nBit of code organisation Former-commit-id: ad1c61bf968059510c6be9e7f2cceec7da70ba17
This commit is contained in:
@@ -14,9 +14,9 @@ func main() {
|
||||
// - {{ current }}
|
||||
app.RegisterView(iris.HTML("./templates", ".html"))
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
ctx.ViewData("Name", "iris") // the .Name inside the ./templates/hi.html
|
||||
ctx.Gzip(true) // enable gzip for big files
|
||||
ctx.View("hi.html") // render the template with the file name relative to the './templates'
|
||||
ctx.Compress(true) // enable compression based on Accept-Encoding (e.g. "gzip").
|
||||
ctx.ViewData("Name", "iris") // the .Name inside the ./templates/hi.html.
|
||||
ctx.View("hi.html") // render the template with the file name relative to the './templates'.
|
||||
})
|
||||
|
||||
// http://localhost:8080/
|
||||
|
||||
Reference in New Issue
Block a user