forked from kataras/iris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
42 lines (32 loc) · 807 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// 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{"[email protected]", "[email protected]"},
Jobs: []*Job{&job1, &job2},
}
ctx.View("index.pug", person)
}