Exemplo n.º 1
0
func Fibonacci(ctx *macaron.Context) {
	number := ctx.QueryInt("number")
	log.Println("DBG:", number)

	result := models.FibonacciSequence(number)
	if result < 0 {
		ctx.JSON(422, map[string]string{
			"error": "Unprocessable number: " + com.ToStr(number),
		})
		return
	}

	ctx.JSON(200, map[string]interface{}{
		"result": result,
	})
}
Exemplo n.º 2
0
func queryHandler(ctx *macaron.Context) {
	fmt.Println(ctx.Query("uid"))
	fmt.Println(ctx.QueryInt("uid"))
	fmt.Println(ctx.QueryInt64("uid"))
}