mirror of
https://github.com/kataras/iris.git
synced 2026-01-23 11:56:00 +00:00
formatting
Former-commit-id: 037081db5d6d4434e873ca8b75334ee43e046b6a
This commit is contained in:
@@ -14,11 +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'
|
||||
|
||||
})
|
||||
|
||||
// http://localhost:8080/
|
||||
|
||||
@@ -59,7 +59,6 @@ func main() {
|
||||
// http://localhost:8080
|
||||
// http://localhost:8080/redirect/my-page1
|
||||
app.Run(iris.Addr(":8080"))
|
||||
|
||||
}
|
||||
|
||||
func writePathHandler(ctx iris.Context) {
|
||||
|
||||
@@ -91,7 +91,7 @@ func main() {
|
||||
})
|
||||
app.RegisterView(tmpl) // <--
|
||||
|
||||
var todos = map[string]*tTODO{
|
||||
todos := map[string]*tTODO{
|
||||
"example-todo-1": {Text: "Add an show todo page to the example project", Done: true},
|
||||
"example-todo-2": {Text: "Add an add todo page to the example project"},
|
||||
"example-todo-3": {Text: "Add an update todo page to the example project"},
|
||||
|
||||
@@ -25,5 +25,4 @@ func index(ctx iris.Context) {
|
||||
// Q: why need extension .pug?
|
||||
// A: Because you can register more than one view engine per Iris application.
|
||||
ctx.View("index.pug")
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ func main() {
|
||||
RefTitle: "Iris web framework",
|
||||
RefLink: "https://iris-go.com",
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
app.Logger().Errorf("error from app.View: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user