1 Star 0 Fork 0

hh / iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
main.go 807 Bytes
一键复制 编辑 原始数据 按行查看 历史
// Package main shows an example of pug actions based on https://github.com/Joker/jade/tree/master/example/actions
package main
import "github.com/kataras/iris"
type Person struct {
Name string
Age int
Emails []string
Jobs []*Job
}
type Job struct {
Employer string
Role string
}
func main() {
app := iris.New()
tmpl := iris.Pug("./templates", ".pug")
app.RegisterView(tmpl)
app.Get("/", index)
// http://localhost:8080
app.Run(iris.Addr(":8080"))
}
func index(ctx iris.Context) {
job1 := Job{Employer: "Monash B", Role: "Honorary"}
job2 := Job{Employer: "Box Hill", Role: "Head of HE"}
person := Person{
Name: "jan",
Age: 50,
Emails: []string{"jan@newmarch.name", "jan.newmarch@gmail.com"},
Jobs: []*Job{&job1, &job2},
}
ctx.View("index.pug", person)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/w1229748769/iris.git
git@gitee.com:w1229748769/iris.git
w1229748769
iris
iris
v11.1.1

搜索帮助

344bd9b3 5694891 D2dac590 5694891