2013-05-08 22:57:52 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2013-05-08 23:11:03 -07:00
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"math/rand"
|
2013-05-08 22:57:52 -07:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
func attempt(w http.ResponseWriter, req *http.Request) {
|
2013-05-08 23:11:03 -07:00
|
|
|
operation := "+"
|
|
|
|
if r := rand.Intn(2); r == 0 {
|
|
|
|
operation = "-"
|
|
|
|
}
|
|
|
|
|
|
|
|
r := map[string]string{
|
|
|
|
"operation": operation,
|
|
|
|
}
|
|
|
|
|
|
|
|
b, err := json.Marshal(r)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal("issue with json marshalling")
|
|
|
|
}
|
|
|
|
j := string(b)
|
|
|
|
fmt.Println(j)
|
|
|
|
fmt.Fprintf(w, j)
|
2013-05-08 22:57:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func problem(w http.ResponseWriter, req *http.Request) {
|
2013-05-08 23:11:03 -07:00
|
|
|
fmt.Fprintf(w, "hello world")
|
2013-05-08 22:57:52 -07:00
|
|
|
}
|