func indexHandler(ctx *HttpContext) { name := ctx.Get("name").(string) fmt.Fprintf(ctx.W, "Hello %s!", name) }
func profileHandler(ctx *HttpContext) { age := ctx.Get("age").(int) fmt.Fprintf(ctx.W, "Your age is %d.", age) }In this example, the "age" key is retrieved from the HTTP context and type-casted to an integer value. It assumes that the "age" key has been previously set in the context.