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) } }
func Index(c *context.Context) { c.Html("index", nil) }
func reJsonError(c *context.Context) { c.JsonError(1, "Response Json Error") }
func reJsonSuccess(c *context.Context) { m := Message{"Jiang", "Response Json Success", 2} c.JsonSuccess(m) }
func reText(c *context.Context) { c.Text("Response Text") }
func index(c *context.Context) { c.Html("demo", demoUnits) }