Esempio n. 1
0
func (this *BlogController) Index(ctx web.Context) {
	ctx.Render(BlogModel{
		Posts: []BlogPost{
			BlogPost{
				Title: "Blog Post #1",
				Date:  time.Now(),
				Body:  template.HTML("An example blog post."),
				Author: User{
					FirstName: "Montana",
					LastName:  "Banana",
				},
			},
			BlogPost{
				Title: "Blog Post #2",
				Date:  time.Now(),
				Body:  template.HTML("Another example blog post."),
				Author: User{
					FirstName: "Montana",
					LastName:  "Banana",
				},
			},
		},
	})
}
Esempio n. 2
0
func (this *BlogController) Show(ctx web.Context, id int) {
	ctx.Write(fmt.Sprint("ID: ", id))
}