Example #1
0
func Demo(c *context.Context) {
	s := c.FormValue("s")
	switch s {
	case "ResponseText":
		reText(c)
	case "ResponseJsonSuccess":
		reJsonSuccess(c)
	case "ResponseJsonError":
		reJsonError(c)
	default:
		index(c)
	}
}
Example #2
0
func Index(c *context.Context) {
	c.Html("index", nil)
}
Example #3
0
func reJsonError(c *context.Context) {
	c.JsonError(1, "Response Json Error")
}
Example #4
0
func reJsonSuccess(c *context.Context) {
	m := Message{"Jiang", "Response Json Success", 2}
	c.JsonSuccess(m)
}
Example #5
0
func reText(c *context.Context) {
	c.Text("Response Text")
}
Example #6
0
func index(c *context.Context) {
	c.Html("demo", demoUnits)
}